📚 Operating Systems for A-Level Edexcel Computer Science | A-Level Edexcel 计算机操作系统考点精讲
Understanding operating systems is fundamental to A-Level Computer Science. An OS manages hardware resources, provides a user interface, and enables multitasking. This article breaks down key topics specified in the Edexcel syllabus, including interrupts, scheduling, memory management, and virtual machines.
理解操作系统是A-Level计算机科学的基础。操作系统管理硬件资源、提供用户界面并启用多任务处理。本文分解Edexcel大纲中指定的关键主题,包括中断、调度、内存管理和虚拟机。
1. What is an Operating System? | 什么是操作系统?
An operating system (OS) is a layer of software that acts as an intermediary between the user and the computer hardware. It controls the execution of applications, manages memory, and provides a consistent environment.
操作系统(OS)是充当用户与计算机硬件之间中介的一层软件。它控制应用程序的执行、管理内存并提供一致的环境。
The OS performs two essential roles: providing a virtual machine that hides the complexity of hardware, and managing resources such as the CPU, memory, and I/O devices.
操作系统执行两个重要角色:提供隐藏硬件复杂性的虚拟机,以及管理CPU、内存和I/O设备等资源。
2. Functions of an Operating System | 操作系统的功能
Key functions include processor management (scheduling processes on the CPU), memory management (allocating and deallocating RAM), device management (handling I/O through drivers), file management (organising data on storage), and providing a user interface.
主要功能包括处理器管理(在CPU上调度进程)、内存管理(分配和释放RAM)、设备管理(通过驱动程序处理I/O)、文件管理(组织存储上的数据)以及提供用户界面。
The OS also ensures security by controlling access through user accounts, and offers networking capabilities for communication between devices.
操作系统还通过用户账户控制访问来确保安全,并提供设备间通信的联网能力。
3. Types of Operating Systems | 操作系统的类型
Common types include batch processing systems, interactive (real-time) systems, multitasking OS that allow concurrent program execution, and distributed systems that run across multiple machines. Edexcel students should recognise the difference between single-user and multi-user OS.
常见类型包括批处理系统、交互式(实时)系统、允许多程序并发执行的多任务操作系统,以及跨多台机器运行的分布式系统。Edexcel学生应识别单用户和多用户操作系统之间的区别。
4. Interrupts and the Interrupt Cycle | 中断与中断周期
An interrupt is a signal from hardware or software that requires immediate attention. When an interrupt occurs, the CPU suspends the current process, saves its state, and executes an Interrupt Service Routine (ISR) stored in memory.
中断是来自硬件或软件的需要立即处理的信号。当中断发生时,CPU挂起当前进程、保存其状态,并执行存储在内存中的中断服务程序(ISR)。
The interrupt cycle involves: checking for interrupts at the end of each fetch-decode-execute cycle. If an interrupt is pending with higher priority, the CPU pushes the program counter and status register onto the stack, then loads the address of the ISR from the interrupt vector table.
中断周期涉及:在每个取指-译码-执行周期结束时检查中断。如果有更高优先级的中断待处理,CPU将程序计数器和状态寄存器压入栈,然后从中断向量表加载ISR的地址。
After servicing the interrupt, the CPU pops the saved state and resumes the interrupted process. This mechanism enables responsive multitasking.
处理完中断后,CPU弹出保存的状态并恢复被中断的进程。该机制实现了响应式多任务处理。
5. Process Scheduling | 进程调度
The OS uses a scheduler to decide which process runs next. Scheduling algorithms can be preemptive (a process can be interrupted) or non-preemptive. Edexcel requires understanding of Round Robin, First Come First Served, Multi-level Feedback Queue, Shortest Job First, and Shortest Remaining Time.
操作系统使用调度程序来决定下一个运行哪个进程。调度算法可以是抢占式(进程可被中断)或非抢占式。Edexcel要求理解轮转、先到先服务、多级反馈队列、最短作业优先和最短剩余时间。
In FCFS, processes execute in the order they arrive; it is simple but can cause the ‘convoy effect’. Round Robin assigns a fixed time quantum; after the quantum expires, the process is moved to the back of the queue, ensuring fairness.
在FCFS中,进程按到达顺序执行;它简单但可能导致”护航效应”。轮转分配固定的时间片;时间片用完后,进程移到队列末尾,确保公平。
Shortest Job First (non-preemptive) selects the process with the smallest total execution time next, minimising average waiting time. Its preemptive version, Shortest Remaining Time, preempts if a new process arrives with shorter remaining time.
最短作业优先(非抢占式)选择总执行时间最小的进程,最小化平均等待时间。其抢占式版本,最短剩余时间,如果新到达的进程剩余时间更短则抢占。
Multi-level Feedback Queue uses several queues with different priorities; processes can move between queues based on their behaviour, balancing responsiveness for interactive jobs and throughput for batch jobs.
多级反馈队列使用多个具有不同优先级的队列;进程可根据行为在队列之间移动,平衡交互作业的响应性和批处理作业的吞吐量。
6. Memory Management – Paging | 内存管理 – 分页
Paging divides physical memory into fixed-size blocks called frames, and logical memory into pages of the same size. The OS maintains a page table to map each logical page to a physical frame.
分页将物理内存划分为固定大小的块(称为帧),将逻辑内存划分为相同大小的页。操作系统维护一个页表,将每个逻辑页映射到物理帧。
The logical address generated by the CPU is split into a page number and an offset. The page number indexes the page table; if the page is in memory, the frame number is combined with the offset to produce the physical address.
CPU生成的逻辑地址分为页号和偏移量。页号索引页表;如果该页在内存中,帧号与偏移量组合形成物理地址。
Paging eliminates external fragmentation but introduces some internal fragmentation. It also enables protection by marking pages as read-only or supervisor.
分页消除了外部碎片,但引入了少量内部碎片。它还通过将页标记为只读或超级用户来实现保护。
7. Memory Management – Segmentation | 内存管理 – 分段
Segmentation divides memory into variable-sized segments that correspond to logical units like functions or data structures. Each segment has a base address and a limit. The CPU uses a segment table to translate a logical address (segment number : offset) into a physical address by adding the offset to the base if the offset is within the limit.
分段将内存划分为可变大小的段,这些段对应逻辑单元,如函数或数据结构。每个段有基地址和界限。CPU使用段表将逻辑地址(段号:偏移量)转换为物理地址,如果偏移量在界限内,则将偏移量加到基址上。
Segmentation aids sharing and protection since segments correspond to logical program entities. However, it can suffer from external fragmentation.
分段有助于共享和保护,因为段对应逻辑程序实体。然而,它可能遭受外部碎片问题。
8. Virtual Memory | 虚拟内存
Virtual memory allows the execution of processes that are not completely in main memory, enabling the system to run larger applications and more concurrent programs. It uses demand paging, where pages are loaded only when needed.
虚拟内存允许执行不完全在主存中的进程,使系统能够运行更大的应用程序和更多的并发程序。它使用请求分页,仅在需要时加载页。
When a required page is not in memory, a page fault occurs. The OS must locate the page on disk, find a free frame (or use a page replacement algorithm like LRU or Clock), load the page, and update the page table.
当所需页不在内存中时,会发生缺页。OS必须在磁盘上定位该页,找到空闲帧(或使用页面置换算法,如LRU或时钟算法),加载页,并更新页表。
Virtual memory uses a backing store (usually a hard disk or SSD) to hold swapped-out pages. The translation lookaside buffer (TLB) caches recent page table entries to speed up address translation.
虚拟内存使用后备存储(通常是硬盘或SSD)来存放换出的页。转译后备缓冲区(TLB)缓存最近的页表项以加速地址转换。
9. Input / Output Management | 输入输出管理
I/O management handles communication between the computer and peripheral devices such as keyboards, disks, and printers. Device drivers provide a uniform interface for the OS to control hardware, abstracting device-specific details.
I/O管理处理计算机与键盘、磁盘和打印机等外围设备之间的通信。设备驱动程序为OS提供统一接口来控制硬件,抽象出设备特定细节。
The OS uses techniques like buffering (temporary storage to smooth speed mismatches), spooling (placing data in a queue for devices like printers), and direct memory access (DMA) where a controller transfers data directly between device and memory without CPU involvement.
操作系统使用缓冲(临时存储以平滑速度不匹配)、假脱机(将数据放入队列用于打印机等设备)和直接存储器访问(DMA)等技术,其中控制器直接在设备和内存之间传输数据,无需CPU参与。
10. File Systems | 文件系统
A file system organises data into files and directories on storage media. It provides operations such as create, delete, open, close, read, and write. The directory structure can be flat, hierarchical, or a directed acyclic graph.
文件系统将数据组织成存储介质上的文件和目录。它提供创建、删除、打开、关闭、读取和写入等操作。目录结构可以是平面的、分层的或有向无环图。
File allocation methods include contiguous allocation (simple but wastes space), linked allocation (each block points to the next, no external fragmentation but slower random access), and indexed allocation (a block holds pointers to all blocks, efficient but overhead). Edexcel students should understand the trade-offs.
文件分配方法包括连续分配(简单但浪费空间)、链接分配(每个块指向下一个,无外部碎片但随机访问较慢)和索引分配(一个块保存所有块的指针,高效但有开销)。Edexcel学生应理解其中的权衡。
11. Virtual Machines | 虚拟机
A virtual machine (VM) is a software emulation of a physical computer. The host OS runs a hypervisor that creates isolated environments, each running its own guest OS. This allows multiple operating systems to run concurrently on the same hardware.
虚拟机(VM)是对物理计算机的软件模拟。主机操作系统运行一个虚拟机监控程序,创建隔离环境,每个环境运行自己的客户操作系统。这允许多个操作系统在同一硬件上并发运行。
Benefits include resource utilisation, sandboxing for security, and easy migration. The hypervisor can be Type 1 (bare metal) or Type 2 (hosted). Edexcel may ask about the role of VMs in modern computing.
好处包括资源利用率、安全沙箱和易于迁移。虚拟机监控程序可以是类型1(裸机型)或类型2(托管型)。Edexcel可能会问及虚拟机在现代计算中的作用。
12. OS Security and User Management | 操作系统安全与用户管理
The OS enforces security through authentication (passwords, biometrics), authorisation (access control lists), and accounting (audit logs). User accounts can be administrator or standard, each with distinct privileges.
操作系统通过身份验证(密码、生物识别)、授权(访问控制列表)和审计(审计日志)来加强安全。用户账户可以是管理员或标准用户,各有不同的权限。
Protection mechanisms ensure that processes cannot interfere with each other’s memory or resources. The OS runs in kernel mode (supervisor) while user programs run in user mode, with hardware-enforced boundaries.
保护机制确保进程不能互相干扰内存或资源。操作系统在内核模式(超级用户)下运行,而用户程序在用户模式下运行,具有硬件强制的边界。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导