A-Level AQA Computer Science: Operating Systems Revision Guide | 操作系统考点精讲

📚 A-Level AQA Computer Science: Operating Systems Revision Guide | 操作系统考点精讲

Operating systems are the fundamental software layer that manages hardware and provides services for application programs. In the AQA A-Level Computer Science specification, understanding how an OS handles memory, processors, interrupts and peripheral devices is essential. This revision guide breaks down each key topic to help you master the concepts and confidently answer exam questions.

操作系统是管理硬件并为应用程序提供服务的基础软件层。在AQA A-Level计算机科学考试大纲中,理解操作系统如何处理内存、处理器、中断和外围设备至关重要。这份复习指南将逐一分解每个关键主题,帮助你掌握概念,自信地应对考试题目。

1. What Is an Operating System? | 什么是操作系统?

An operating system (OS) is a collection of system programs that act as an intermediary between the user and computer hardware. It provides a platform on which other software can run, hiding the complexity of the underlying hardware. Common examples include Windows, Linux, macOS, and real-time OS like FreeRTOS used in embedded systems.

操作系统(OS)是一组系统程序的集合,充当用户与计算机硬件之间的中介。它提供了一个其他软件可以运行的平台,隐藏底层硬件的复杂性。常见例子包括Windows、Linux、macOS,以及用于嵌入式系统的实时操作系统如FreeRTOS。

The OS kernel is the core component that remains in main memory and controls all critical operations. The shell or user interface allows users to communicate with the OS either through a command line interface (CLI) or a graphical user interface (GUI).

操作系统内核是驻留在主存中的核心组件,控制所有关键操作。外壳或用户界面允许用户通过命令行界面(CLI)或图形用户界面(GUI)与操作系统通信。


2. Core Functions of an Operating System | 操作系统的核心功能

The AQA specification requires you to describe five main functions of an operating system: memory management, processor scheduling, backing store management, peripheral management (input/output), and providing a user interface. Each function ensures efficient, fair and secure use of hardware.

AQA考纲要求你描述操作系统的五个主要功能:内存管理、处理器调度、后备存储管理、外设管理(输入/输出)以及提供用户界面。每个功能都确保硬件被高效、公平且安全地使用。

Memory management allocates RAM to processes and ensures they do not interfere with each other. Processor scheduling decides which process gets CPU time and for how long. Backing store management organises files on secondary storage such as HDDs or SSDs. Peripheral management handles communication with devices like keyboards, mice, and printers through device drivers. The user interface might be a CLI or GUI, allowing users to launch programs and manage files.

内存管理为进程分配RAM并确保它们互不干扰。处理器调度决定哪个进程获得CPU时间以及时长。后备存储管理组织文件在辅助存储器如HDD或SSD上的存放。外设管理通过设备驱动程序处理与键盘、鼠标、打印机等设备的通信。用户界面可能是CLI或GUI,允许用户启动程序和管理文件。


3. Types of Operating Systems | 操作系统的类型

Different environments require different OS types. The main classifications are: interactive (multi-user, time-sharing), real-time, network, device (embedded), and batch. You need to recognise the characteristics of each and be able to match them to scenarios.

不同的环境需要不同类型的操作系统。主要分类有:交互式(多用户、分时)、实时、网络、设备(嵌入式)和批处理。你需要识别每种操作系统的特征,并能为具体场景匹配合适的类型。

An interactive OS supports multiple users simultaneously and responds quickly, such as UNIX. Real‑time OS must process data within strict time constraints; a hard real‑time system cannot miss any deadline (e.g., airbag deployment), while a soft real‑time OS tolerates occasional delays (e.g., video streaming). A network OS provides file sharing and printer services over a LAN. A device OS is tailored for specific hardware like smartphones or washing machines. A batch OS executes jobs in groups without user interaction, commonly used for large‑scale data processing.

交互式操作系统同时支持多个用户并快速响应,如UNIX。实时操作系统必须在严格的时间限制内处理数据;硬实时系统不能错过任何截止时间(例如安全气囊展开),而软实时操作系统容许偶尔延迟(例如视频流)。网络操作系统提供局域网上的文件共享和打印机服务。设备操作系统为特定硬件定制,如智能手机或洗衣机。批处理操作系统成组执行作业而无需用户交互,常用于大规模数据处理。


4. Memory Management Fundamentals | 内存管理基础

Memory management is the process of controlling and coordinating computer memory, assigning portions to running programs and freeing space when they finish. The OS must protect the memory space of each process and prevent fragmentation. Physical addresses are actual locations in RAM, while logical addresses are generated by the CPU for a process.

内存管理是控制和协调计算机内存的过程,为运行的程序分配内存部分,并在程序结束时释放空间。操作系统必须保护每个进程的内存空间并防止碎片化。物理地址是RAM中的实际位置,而逻辑地址由CPU为进程生成。

The memory management unit (MMU) translates logical addresses to physical addresses. In a simple single‑contiguous allocation, the OS occupies low memory and a user program occupies the remaining space, but this wastes resources. Modern OS use multiprogramming and techniques like partitioning, paging, or segmentation. The OS also uses swapping to move inactive processes temporarily to backing store when RAM is full.

内存管理单元(MMU)将逻辑地址转换为物理地址。在简单的单一连续分配中,操作系统占据低端内存,用户程序占据剩余空间,但这会浪费资源。现代操作系统使用多道程序设计和分区、分页或分段等技术。操作系统还使用交换技术,在RAM满时将不活跃的进程临时移动到后备存储。


5. Paging and Segmentation | 分页与分段

Paging is a memory management scheme that divides physical memory into fixed‑size blocks called frames, and logical memory into blocks of the same size called pages. When a process runs, its pages are loaded into any available frames; a page table keeps track of the mapping between page numbers and frame numbers. This eliminates external fragmentation but introduces a small amount of internal fragmentation.

分页是一种内存管理方案,将物理内存划分为固定大小的块,称为帧,将逻辑内存划分为同样大小的块,称为页。当一个进程运行时,它的页被加载到任何可用的帧中;页表记录页号和帧号之间的映射关系。这消除了外部碎片,但引入了少量内部碎片。

Segmentation divides a program into variable‑sized segments, each representing a logical unit such as a function, array, or stack. Segment tables hold the base address and limit for each segment. Segmentation matches the programmer’s view more closely and supports protection and sharing, but it can cause external fragmentation. Many real systems combine paging and segmentation, for instance by paging the segments.

分段是将程序划分为大小可变的段,每个段代表一个逻辑单元,如函数、数组或栈。段表存储每个段的基址和界限。分段更贴合程序员的视角,并支持保护与共享,但可能导致外部碎片。许多实际系统结合分页和分段,例如对段进行分页。


6. Virtual Memory | 虚拟内存

Virtual memory is a technique that allows the execution of processes that are not completely in physical memory. It separates logical memory from physical memory, enabling a program to be larger than the available RAM. The OS keeps only the needed parts of a process in memory, while the rest resides on secondary storage. This is typically implemented through demand paging.

虚拟内存是一种技术,允许在不完全放入物理内存的情况下执行进程。它将逻辑内存与物理内存分开,使程序可以比可用RAM更大。操作系统仅将进程所需的部分保留在内存中,其余部分驻留在辅助存储器中。这通常通过请求分页实现。

When a logical address is accessed that is not in RAM, a page fault occurs. The OS then loads the required page from disk, possibly replacing an existing page using a page replacement algorithm such as least recently used (LRU). Virtual memory improves multitasking and memory utilisation but can lead to thrashing if the system spends more time swapping pages than executing processes.

当访问的逻辑地址不在RAM中时,会发生缺页中断。然后操作系统从磁盘加载所需页面,可能使用页面置换算法(如最近最少使用LRU)替换现有页面。虚拟内存改进了多任务处理和内存利用率,但如果系统花费更多时间换页而非执行进程,就可能导致颠簸。


7. Processor Scheduling Concepts | 处理器调度概念

Processor scheduling is the method by which the OS decides which process can use the CPU at a given time. This is essential in multiprogramming environments to maximise CPU usage and ensure fairness. A process may go through several states: new, ready, running, waiting, and terminated. The process control block (PCB) stores all the information about a process, including its state, program counter, CPU registers, and memory limits.

处理器调度是操作系统决定哪个进程在给定时刻使用CPU的方法。这在多道程序设计环境中至关重要,可以最大化CPU使用率并确保公平性。一个进程可能经历多个状态:新建、就绪、运行、等待和终止。进程控制块(PCB)存储有关进程的所有信息,包括状态、程序计数器、CPU寄存器和内存界限。

The dispatcher is the module that gives control of the CPU to the process selected by the short‑term scheduler. Context switching time is the overhead involved in switching the CPU from one process to another; the OS must save the state of the old process and load the saved state of the new one. Efficient scheduling aims to minimise context switches while maintaining responsiveness.

分派器是将CPU控制权交给短期调度器所选进程的模块。上下文切换时间是CPU从一个进程切换到另一个进程所涉及的开销;操作系统必须保存旧进程的状态并加载新进程的已保存状态。高效调度旨在最小化上下文切换,同时保持响应性。


8. Scheduling Algorithms | 调度算法

AQA expects you to evaluate several scheduling algorithms: first‑come, first‑served (FCFS), shortest job first (SJF), shortest remaining time (SRT), round‑robin (RR), multi‑level feedback queue (MLFQ), and priority‑based scheduling. Each can be non‑pre‑emptive (a running process keeps the CPU until it voluntarily yields) or pre‑emptive (the OS can force a context switch).

AQA要求你评估几种调度算法:先来先服务(FCFS)、最短作业优先(SJF)、最短剩余时间(SRT)、轮转(RR)、多级反馈队列(MLFQ)和基于优先级的调度。每种算法可以是非抢占式(正在运行的进程保持CPU直到自愿放弃)或抢占式(操作系统可以强制上下文切换)。

FCFS is simple but can suffer from the convoy effect, where short jobs get stuck behind long jobs. SJF gives optimal average waiting time but requires knowledge of future CPU bursts. SRT is the pre‑emptive version of SJF. Round‑robin assigns a time quantum; if the process does not complete within the quantum, it is returned to the ready queue. MLFQ provides multiple queues with different priorities and time quanta, allowing interactive processes to get quick service while background jobs run less frequently. Priority scheduling can lead to starvation, which can be solved by aging (gradually increasing the priority of waiting processes).

FCFS简单但可能出现护航效应,即短作业被长作业卡住。SJF提供最优的平均等待时间,但需要知道未来的CPU突发时间。SRT是SJF的抢占版本。轮转调度分配一个时间片;如果进程在时间片内未完成,则返回到就绪队列。MLFQ提供多个具有不同优先级和时间片的队列,允许交互进程获得快速服务,而后台作业运行频率较低。优先级调度可能导致饥饿,可以通过老化(逐渐增加等待进程的优先级)来解决。


9. Interrupts and the Interrupt Cycle | 中断与中断周期

Interrupts are signals sent from hardware or software to the processor, indicating that an event needs immediate attention. They are fundamental to how the OS manages I/O and maintains control. When an interrupt occurs, the processor finishes its current instruction, saves the program counter and other registers, and jumps to an interrupt service routine (ISR) whose address is stored in the interrupt vector.

中断是从硬件或软件向处理器发出的信号,表示某个事件需要立即处理。它们是操作系统管理I/O并维持控制的基础。当中断发生时,处理器完成当前指令,保存程序计数器和其他寄存器,并跳转到中断服务例程(ISR),其地址存储在中断向量中。

The interrupt cycle includes: checking for interrupts at the end of each fetch-decode-execute cycle; if an interrupt exists, acknowledging it; disabling further interrupts while the ISR runs; saving the context; servicing the interrupt; restoring the context; and returning to the original program. Multilevel interrupts with priorities ensure that critical interrupts (e.g., clock) are handled before less urgent ones.

中断周期包括:在每条取指-译码-执行周期结束时检查中断;如果存在中断,进行确认;在ISR运行时禁止进一步中断;保存上下文;处理中断;恢复上下文;并返回原程序。具有优先级的嵌套中断确保关键中断(如时钟)先于不太紧急的中断被处理。


10. Multi‑tasking and Resource Management | 多任务与资源管理

Multi‑tasking allows an operating system to run multiple processes apparently simultaneously on a single processor by rapidly switching between them. This relies on efficient scheduling and context switching. The OS must also manage shared resources to prevent conflicts. Deadlock is a situation where a set of processes are blocked because each is holding a resource and waiting for another resource held by another process. The OS can prevent deadlock by eliminating one of the four necessary conditions: mutual exclusion, hold and wait, no pre‑emption, or circular wait.

多任务处理使操作系统能在单处理器上通过快速切换进程,实现看起来同时运行多个进程。这依赖于高效的调度和上下文切换。操作系统还必须管理共享资源以防止冲突。死锁是指一组进程均被阻塞,因为每个进程都持有一个资源并等待另一个进程持有的资源。操作系统可以通过消除四个必要条件之一来预防死锁:互斥、持有并等待、不可抢占或循环等待。

Semaphores and mutexes are synchronisation mechanisms used to control access to critical sections. A semaphore is a protected variable whose value can be accessed only by wait() and signal() operations. A mutex is a binary lock ensuring that only one process or thread enters a critical region at a time. These concepts appear in the AQA specification in the context of process coordination.

信号量和互斥量是用于控制对临界区访问的同步机制。信号量是一个受保护的变量,其值只能通过wait()和signal()操作访问。互斥量是一种二元锁,确保一次只有一个进程或线程进入临界区。这些概念出现在AQA考纲的进程协调部分。


11. File and Device Management | 文件与设备管理

The OS organises files on secondary storage using a hierarchical directory structure and maintains metadata such as file size, permissions, and location. File allocation can be contiguous, linked, or indexed. Contiguous allocation is fast for reading but suffers from external fragmentation. Linked allocation uses pointers to connect blocks, avoiding fragmentation but making random access slow. Indexed allocation stores all block pointers in an index block, supporting fast random access.

操作系统使用分层目录结构在辅助存储器上组织文件,并维护元数据,如文件大小、权限和位置。文件分配可以是连续、链接或索引方式。连续分配读取速度快,但会出现外部碎片。链接分配使用指针连接块,避免碎片但随机访问变慢。索引分配将所有块指针存储在索引块中,支持快速随机访问。

Device management is handled by device drivers, which are low‑level programs that translate generic OS commands into commands specific to a hardware device. When the OS needs to perform I/O, it calls the driver, which communicates with the device controller. Input/output can be programmed I/O (polling), interrupt‑driven, or use direct memory access (DMA) to bypass the CPU for large transfers.

设备管理由设备驱动程序处理,这些底层程序将通用的操作系统命令转换为特定硬件设备的命令。当操作系统需要执行I/O时,它调用驱动程序,驱动程序与设备控制器通信。输入/输出可以是程序控制I/O(轮询)、中断驱动或使用直接存储器访问(DMA)在大量传输时绕过CPU。


12. Virtual Machines and System Software | 虚拟机与系统软件

A virtual machine (VM) is a software emulation of a physical computer, running its own OS and applications as if it were separate hardware. The hypervisor is the layer that creates and manages VMs, enabling multiple guest operating systems to share the underlying physical resources. This provides isolation, security, and the ability to run legacy or different OSs simultaneously. The concept is relevant to AQA’s coverage of system software and how OS can provide abstraction.

虚拟机(VM)是对物理计算机的软件仿真,运行自己的操作系统和应用程序,如同独立的硬件一样。虚拟机管理程序(hypervisor)是创建和管理虚拟机的层,允许多个客户操作系统共享底层物理资源。这提供了隔离、安全性以及同时运行遗留或不同操作系统的能力。这一概念与AQA关于系统软件以及操作系统如何提供抽象的内容相关。

System software encompasses the OS, utilities (disk defragmenters, backup tools, antivirus), libraries, and translators (assemblers, compilers, interpreters). The OS works closely with these components to provide a complete environment. An understanding of virtual machines helps grasp how an OS can present a uniform hardware interface to diverse software stacks.

系统软件包括操作系统、实用程序(磁盘碎片整理程序、备份工具、防病毒软件)、库和翻译器(汇编器、编译器、解释器)。操作系统与这些组件密切协作,提供完整的环境。理解虚拟机有助于领会操作系统如何向多样化软件堆栈提供统一的硬件接口。


Published by TutorHao | Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading