📚 A-Level Computer Science: Detailed Guide to Operating System Functions | A-Level计算机:操作系统功能详解
An operating system (OS) is the most fundamental software that manages all hardware and software resources of a computer system. For CIE A-Level Computer Science, understanding the core functions of an operating system is essential, as questions on process management, memory allocation, and file systems frequently appear in both Paper 1 and Paper 2. This guide provides a comprehensive, exam-focused breakdown of the key functions of an operating system.
操作系统(OS)是管理计算机系统所有硬件和软件资源的最基础软件。在CIE A-Level计算机科学考试中,理解操作系统的核心功能至关重要,因为进程管理、内存分配和文件系统相关的问题在Paper 1和Paper 2中频繁出现。本指南将提供一个全面且紧扣考点的操作系统关键功能详解。
1. Process Management | 进程管理
The operating system is responsible for managing processes — programs in execution. It handles process creation, scheduling, and termination. The OS allocates CPU time to multiple processes using scheduling algorithms such as First-Come-First-Served (FCFS), Round Robin, and Shortest Job First (SJF). Each process is represented by a Process Control Block (PCB) containing its program counter, register values, and process state (ready, running, blocked, terminated).
操作系统负责管理进程——即正在执行的程序。它处理进程的创建、调度和终止。操作系统使用先来先服务(FCFS)、时间片轮转(Round Robin)和最短作业优先(SJF)等调度算法,将CPU时间分配给多个进程。每个进程由一个进程控制块(PCB)表示,其中包含程序计数器、寄存器值和进程状态(就绪、运行、阻塞、终止)。
Process States: new → ready → running ⇌ blocked → terminated
进程状态:新建 → 就绪 → 运行 ⇌ 阻塞 → 终止
The scheduler must decide which process in the ready queue gets CPU time. In a multitasking system, the OS rapidly switches between processes (context switching), giving the illusion that multiple programs run simultaneously. However, context switching incurs overhead, as the OS must save and restore the state of each process.
调度器必须决定就绪队列中哪个进程获得CPU时间。在多任务系统中,操作系统在进程之间快速切换(上下文切换),产生多个程序同时运行的假象。然而,上下文切换会产生开销,因为操作系统必须保存和恢复每个进程的状态。
2. Memory Management | 内存管理
The OS manages primary memory (RAM) and ensures that each process runs in its own allocated memory space. Memory management functions include: tracking which parts of memory are in use, allocating memory to processes, and deallocating memory when processes terminate. Key techniques include paging and segmentation, where memory is divided into fixed-size pages or variable-sized segments to avoid fragmentation.
操作系统管理主存(RAM),确保每个进程在其分配的内存空间中运行。内存管理功能包括:跟踪内存的哪些部分正在使用、为进程分配内存,以及进程终止时释放内存。关键技术包括分页和分段——将内存划分为固定大小的页或可变大小的段,以避免碎片化。
In virtual memory systems, the OS uses a portion of the hard disk as an extension of RAM. When physical memory is full, the OS swaps pages out to disk — a technique called paging. This allows programs larger than physical memory to run, but excessive swapping (thrashing) severely degrades performance. CIE exams often test the difference between logical and physical addresses, and the role of the Memory Management Unit (MMU) in address translation.
在虚拟内存系统中,操作系统将硬盘的一部分用作RAM的扩展。当物理内存满时,操作系统会将页换出到磁盘——这种技术称为分页。这允许比物理内存更大的程序运行,但过度换页(系统抖动)会严重降低性能。CIE考试经常考察逻辑地址和物理地址之间的区别,以及内存管理单元(MMU)在地址转换中的作用。
3. File System Management | 文件系统管理
The OS provides a file system that organizes data into files and directories. It handles file creation, deletion, reading, writing, and access permissions. File systems use hierarchical directory structures (root directory, subdirectories) to enable efficient navigation. Common file allocation methods include contiguous allocation, linked allocation, and indexed allocation.
操作系统提供将数据组织为文件和目录的文件系统。它处理文件的创建、删除、读取、写入和访问权限。文件系统使用层次化目录结构(根目录、子目录)以实现高效导航。常见的文件分配方法包括连续分配、链接分配和索引分配。
Key file system concepts for CIE include: metadata (file name, size, timestamps, permissions), file attributes (read-only, hidden, archive), and file access methods (sequential and direct/random access). The OS enforces access control, ensuring that users can only access files they have permission to view or modify. For example, Unix-based systems use read (r), write (w), and execute (x) permissions for owner, group, and others.
CIE考试的关键文件系统概念包括:元数据(文件名、大小、时间戳、权限)、文件属性(只读、隐藏、存档)和文件访问方式(顺序访问和直接/随机访问)。操作系统实施访问控制,确保用户只能访问其有权查看或修改的文件。例如,基于Unix的系统对所有者、组和其他用户使用读(r)、写(w)和执行(x)权限。
4. Input/Output (I/O) Management | 输入/输出管理
The OS manages communication between the CPU and external devices such as keyboards, mice, disks, and printers. I/O management involves device drivers — specialized software that translates OS instructions into device-specific commands. The OS must handle interrupts, manage I/O queues, and control data transfer between devices and memory.
操作系统管理CPU与键盘、鼠标、磁盘和打印机等外部设备之间的通信。I/O管理涉及设备驱动程序——将操作系统指令转换为设备特定命令的专用软件。操作系统必须处理中断、管理I/O队列,并控制设备与内存之间的数据传输。
Three main I/O techniques are used: programmed I/O (CPU polls the device), interrupt-driven I/O (device signals the CPU when ready), and Direct Memory Access (DMA) (a controller transfers data directly between device and memory without CPU involvement). DMA is the most efficient method for high-speed devices like hard disks, as it frees the CPU for other tasks. CIE questions often ask candidates to compare these techniques and explain why DMA is preferred for bulk data transfers.
使用三种主要的I/O技术:程序控制I/O(CPU轮询设备)、中断驱动I/O(设备就绪时向CPU发信号)和直接存储器访问(DMA)(控制器直接在设备和内存之间传输数据,无需CPU参与)。对于硬盘等高速设备,DMA是最高效的方法,因为它将CPU解放出来处理其他任务。CIE考题常要求考生比较这些技术,并解释为何批量数据传输首选DMA。
5. Security and Access Control | 安全与访问控制
The operating system acts as the first line of defence for computer security. It enforces user authentication (e.g., passwords, biometrics), manages user accounts and privileges, and protects resources from unauthorised access. The OS implements access control lists (ACLs) and capability-based security to determine what each user or process may do.
操作系统是计算机安全的第一道防线。它执行用户身份验证(如密码、生物识别)、管理用户账户和权限,并保护资源免受未授权访问。操作系统实施访问控制列表(ACL)和基于能力的安全机制,以确定每个用户或进程可以执行哪些操作。
Protection mechanisms include memory protection (preventing one process from reading another’s memory), file permissions, and encryption. The OS also logs security events (audit trails) to detect suspicious activity. For CIE, key topics include the principle of least privilege — giving users only the minimum permissions necessary to perform their tasks — and how the OS isolates processes to prevent malicious software from compromising the entire system.
保护机制包括内存保护(防止一个进程读取另一个进程的内存)、文件权限和加密。操作系统还记录安全事件(审计跟踪)以检测可疑活动。对于CIE考试,关键主题包括最小权限原则——只授予用户完成其任务所需的最低权限——以及操作系统如何隔离进程,防止恶意软件危及整个系统。
6. User Interface and Resource Allocation | 用户界面与资源分配
The OS provides a user interface, which may be a Command-Line Interface (CLI) or a Graphical User Interface (GUI). While the CLI offers greater control and is preferred by advanced users and system administrators, the GUI provides an intuitive environment with icons, menus, and windows. Modern operating systems typically offer both interfaces to serve different user needs.
操作系统提供用户界面,可以是命令行界面(CLI)或图形用户界面(GUI)。虽然CLI提供更强的控制力,深受高级用户和系统管理员的青睐,但GUI通过图标、菜单和窗口提供直观的操作环境。现代操作系统通常提供这两种界面,以满足不同用户的需求。
Resource allocation refers to the fair and efficient distribution of system resources (CPU time, memory, I/O devices) among competing processes. The OS uses various algorithms, such as banker’s algorithm for deadlock avoidance, to ensure that resource requests do not lead to deadlock — a situation where processes wait indefinitely for each other’s resources. The four necessary conditions for deadlock are: mutual exclusion, hold and wait, no preemption, and circular wait.
资源分配是指在竞争进程之间公平、高效地分配系统资源(CPU时间、内存、I/O设备)。操作系统使用各种算法(如用于死锁避免的银行家算法),确保资源请求不会导致死锁——即进程无限期等待彼此资源的情况。死锁的四个必要条件为:互斥、持有并等待、不可抢占和循环等待。
7. Interrupt Handling | 中断处理
Interrupts are signals sent to the CPU to indicate that an event requires immediate attention. The operating system manages the interrupt mechanism — it maintains an interrupt vector (a table of handler addresses) and services interrupts according to their priority. When an interrupt occurs, the CPU suspends its current task, saves its state, and jumps to the appropriate Interrupt Service Routine (ISR).
中断是发送给CPU的信号,表示某个事件需要立即处理。操作系统管理中断机制——它维护一个中断向量(处理程序地址表),并根据优先级为中断提供服务。当中断发生时,CPU暂停当前任务,保存其状态,并跳转到相应的中断服务例程(ISR)。
Interrupts are classified as hardware interrupts (e.g., I/O device completing a transfer, timer expiry) and software interrupts (e.g., system calls, exceptions like division by zero). The system call mechanism is crucial — user programs request OS services (such as file I/O or process creation) via system calls, which trigger a software interrupt to switch the CPU from user mode to kernel mode. This mode switching protects the OS and hardware from malicious or erroneous user programs.
中断分为硬件中断(如I/O设备完成传输、定时器到期)和软件中断(如系统调用、除零等异常)。系统调用机制至关重要——用户程序通过系统调用请求操作系统服务(如文件I/O或进程创建),系统调用触发软件中断,使CPU从用户模式切换到内核模式。这种模式切换保护操作系统和硬件免受恶意或错误的用户程序侵害。
8. Process Scheduling Algorithms — Comparison | 进程调度算法——对比
CIE A-Level candidates must be able to compare scheduling algorithms and calculate average waiting time for each. The table below summarises key attributes of common algorithms.
CIE A-Level考生必须能够比较调度算法,并计算每种算法的平均等待时间。下表总结了常见算法的关键属性。
| Algorithm | Preemptive? | Starvation Risk | Key Feature |
| FCFS | No | No | Simple, non-interactive |
| Round Robin | Yes | No | Time quantum, interactive |
| SJF | Both variants | Yes (long jobs) | Optimal avg. waiting time |
| Priority | Usually | Yes (low priority) | Priority-based selection |
In an FCFS system, processes are executed in the order they arrive — easy to implement but produces the convoy effect, where short processes wait behind long ones. Round Robin assigns a fixed time slice (quantum) to each process in the ready queue; if a process does not complete within its quantum, it is moved to the back of the queue. SJF selects the process with the smallest estimated future CPU burst; while it minimises average waiting time, it requires accurate burst-time predictions and can cause starvation of longer processes.
在FCFS系统中,进程按照到达顺序执行——实现简单但会产生护航效应,即短进程排在长进程后面等待。Round Robin为就绪队列中每个进程分配固定时间片(quantum);如果进程在其时间片内未完成,则移至队列末尾。SJF选择估计未来CPU突发时间最短的进程;虽然它能最小化平均等待时间,但需要准确的突发时间预测,并可能导致长进程饥饿。
9. Real-Time Operating Systems | 实时操作系统
A specialised type of operating system, the Real-Time Operating System (RTOS), guarantees deterministic response times within strict deadlines. RTOSs are used in embedded systems such as medical devices, vehicle control systems, and industrial robots. They prioritise timing correctness over average throughput, often using priority-based preemptive scheduling.
实时操作系统(RTOS)是一种特殊类型的操作系统,保证在严格期限内提供确定性的响应时间。RTOS用于嵌入式系统,如医疗设备、车辆控制系统和工业机器人。它们优先考虑时间正确性而非平均吞吐量,通常使用基于优先级的抢占式调度。
Two categories of RTOS exist: hard real-time (a missed deadline causes complete system failure, e.g., an airbag deployment system) and soft real-time (a missed deadline degrades quality but does not cause catastrophic failure, e.g., video streaming). The RTOS kernel typically has minimal overhead, small memory footprint, and provides predictable task-switching latencies. CIE candidates should be able to explain when an RTOS is necessary and contrast it with a general-purpose OS.
RTOS分为两类:硬实时(错过截止时间导致系统完全失败,如安全气囊展开系统)和软实时(错过截止时间降低质量但不引起灾难性失败,如视频流)。RTOS内核通常具有最小开销、小内存占用,并提供可预测的任务切换延迟。CIE考生应能够解释何时需要RTOS,并将其与通用操作系统进行对比。
10. Virtualisation and the OS | 虚拟化与操作系统
Virtualisation allows multiple operating systems to run concurrently on a single physical machine. The hypervisor (virtual machine monitor) sits between the hardware and the guest OSs, allocating virtual resources to each. The host OS may provide the hypervisor (as in VMware Workstation), or the hypervisor may operate directly on hardware (bare-metal, as in VMware ESXi).
虚拟化允许多个操作系统在单台物理机器上并发运行。虚拟机监控器(hypervisor)位于硬件和客户操作系统之间,为每个系统分配虚拟资源。宿主操作系统可以提供虚拟机监控器(如VMware Workstation),或者虚拟机监控器可以直接在硬件上运行(裸机型,如VMware ESXi)。
Benefits of virtualisation include hardware cost reduction, improved resource utilisation, enhanced isolation between applications, and simplified system backup and recovery. The OS must support virtualisation at the processor level (e.g., Intel VT-x, AMD-V) to achieve near-native performance. In cloud computing, virtualisation is the foundational technology that enables scalability and multi-tenancy. CIE exams may ask how an OS distinguishes between physical and virtual resources, or the advantages and disadvantages of virtualisation.
虚拟化的优势包括降低硬件成本、提高资源利用率、增强应用程序之间的隔离性、简化系统备份和恢复。操作系统必须在处理器级别支持虚拟化(如Intel VT-x、AMD-V)才能实现接近原生的性能。在云计算中,虚拟化是支撑可扩展性和多租户的基础技术。CIE考试可能考察操作系统如何区分物理资源和虚拟资源,或虚拟化的优缺点。
Conclusion | 总结
Operating systems are complex software layers that manage processes, memory, files, I/O devices, security, and user interaction. For CIE A-Level Computer Science, mastering these core functions — especially process scheduling, memory management techniques, and the role of interrupts — is vital for achieving top marks. By linking each function to its algorithms and practical applications, you can confidently answer structured questions, calculation-based questions, and extended-response essays.
操作系统是管理进程、内存、文件、I/O设备、安全和用户交互的复杂软件层。对于CIE A-Level计算机科学,掌握这些核心功能——特别是进程调度、内存管理技术和中断的作用——对于获得高分至关重要。通过将每个功能与其算法和实际应用联系起来,你可以自信地回答结构化问题、计算题和扩展写作题。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导