📚 A-Level WJEC Computer Science: Operating Systems Key Points | 操作系统 考点精讲
An operating system (OS) is the fundamental software that manages computer hardware and provides services for application programs. For WJEC A-Level Computer Science, understanding how an OS handles processes, memory, storage, and I/O is essential. This article covers all the key concepts you need to master, from scheduling algorithms to virtual memory and file systems.
操作系统(OS)是管理计算机硬件并为应用程序提供服务的底层软件。在 WJEC A-Level 计算机科学考试中,理解操作系统如何处理进程、内存、存储和输入/输出至关重要。本文涵盖了你需要掌握的所有关键概念,从调度算法到虚拟内存和文件系统。
1. What is an Operating System? | 什么是操作系统?
An operating system is a layer of software that sits between the hardware and user applications. It provides a user interface, manages resources, and ensures the system runs efficiently and securely. Common examples include Windows, Linux, macOS, and Android.
操作系统是位于硬件和用户应用之间的一层软件。它提供用户界面,管理资源,并确保系统高效安全地运行。常见的例子包括 Windows、Linux、macOS 和 Android。
The OS kernel is the core component that remains in memory at all times. It handles process management, memory allocation, device drivers, and system calls. The shell, or command interpreter, allows users to interact with the kernel via a command-line or graphical interface.
操作系统内核是始终驻留在内存中的核心组件。它处理进程管理、内存分配、设备驱动和系统调用。外壳,即命令解释器,允许用户通过命令行或图形界面与内核交互。
2. Functions of an Operating System | 操作系统的功能
The OS performs several critical functions: process management, memory management, file management, I/O management, and security. It abstracts the complexities of hardware, making it easier to write portable applications.
操作系统执行几个关键功能:进程管理、内存管理、文件管理、I/O 管理和安全性。它抽象了硬件的复杂性,使得编写可移植的应用程序更加容易。
Process management involves creating, scheduling, and terminating processes. Memory management controls how RAM is allocated and freed. File management organises data on storage devices into directories and files, while I/O management coordinates communication between the CPU and peripherals like keyboards, disks, and printers.
进程管理涉及创建、调度和终止进程。内存管理控制 RAM 的分配和释放。文件管理将存储设备上的数据组织成目录和文件,而 I/O 管理协调 CPU 与键盘、磁盘和打印机等外围设备之间的通信。
3. Types of Operating Systems | 操作系统的类型
OS types include batch, multi‑tasking (time‑sharing), real‑time, distributed, and embedded systems. A multi‑tasking OS, like modern Windows or Linux, allows multiple programs to run concurrently by rapidly switching the CPU between them.
操作系统类型包括批处理、多任务(分时)、实时、分布式和嵌入式系统。多任务操作系统,如现代 Windows 或 Linux,通过在程序之间快速切换 CPU,允许多个程序并发运行。
A real‑time OS (RTOS) guarantees that critical tasks complete within a strict time limit. It is used in safety‑critical systems such as air traffic control or anti‑lock braking. An embedded OS is designed for devices like smartphones, microwaves, and IoT gadgets, with tight resource constraints.
实时操作系统(RTOS)保证关键任务在严格的时间限制内完成。它用于安全关键系统,如空中交通管制或防抱死制动。嵌入式操作系统专为智能手机、微波炉和物联网设备等资源受限的设备设计。
4. Processes and Threads | 进程与线程
A process is an instance of a program in execution, containing the program code, its data, and a process control block (PCB) that stores registers, priority, and state. Each process has its own memory space, which protects it from interference by other processes.
进程是正在执行的程序实例,包含程序代码、数据以及存储寄存器、优先级和状态的进程控制块(PCB)。每个进程都有自己的内存空间,保护它不受其他进程的干扰。
A thread is the smallest unit of execution within a process. Multiple threads within the same process share the same memory space and can communicate easily, but this can lead to synchronisation problems. Multi‑threading improves responsiveness and allows parallelism on multi‑core CPUs.
线程是进程中最小的执行单元。同一进程中的多个线程共享相同的内存空间,可以轻松通信,但这可能导致同步问题。多线程提高了响应速度,并允许在多核 CPU 上实现并行。
5. Process Scheduling | 进程调度
The scheduler decides which process gets CPU time. Scheduling algorithms are chosen based on system goals: minimising response time, maximising throughput, or ensuring fairness. The main algorithms are First‑Come First‑Served (FCFS), Shortest Job First (SJF), Round Robin (RR), and Priority‑based scheduling.
调度程序决定哪个进程获得 CPU 时间。调度算法的选择基于系统目标:最小化响应时间、最大化吞吐量或确保公平性。主要算法有:先来先服务(FCFS)、最短作业优先(SJF)、轮转调度(RR)和基于优先级的调度。
Round Robin assigns a fixed time quantum to each process in a cyclic order; it is widely used for interactive systems. SJF reduces average waiting time but requires knowing the burst time in advance. Priority scheduling can cause starvation, which is solved by ageing – gradually increasing the priority of waiting processes.
轮转调度以循环顺序为每个进程分配固定的时间片;广泛用于交互式系统。最短作业优先减少平均等待时间,但需要提前知道执行时间。优先级调度可能导致饥饿,这通过老化来解决——逐渐提高等待进程的优先级。
6. Process States and Transitions | 进程状态与转移
A process can be in one of five states: New, Ready, Running, Blocked (Waiting), or Terminated. The transition from Running to Blocked occurs when the process must wait for an I/O event; from Blocked to Ready when the event completes. The dispatcher moves a process from Ready to Running.
进程可以处于五种状态之一:新建、就绪、运行、阻塞(等待)或终止。从运行到阻塞的转移发生在进程必须等待 I/O 事件时;当事件完成时,从阻塞转移到就绪。分派程序将进程从就绪转移到运行。
The New state represents a process that has been created but not yet admitted to the pool of executable processes. Terminated processes exit and release their resources. Understanding these states is key to grasping how a multi‑tasking OS works.
新建状态表示已创建但尚未进入可执行进程池的进程。终止的进程退出并释放其资源。理解这些状态是掌握多任务操作系统如何工作的关键。
7. Memory Management | 内存管理
Memory management allocates RAM to processes and the OS itself, ensuring efficient use and protection. The OS translates logical addresses generated by a program into physical addresses on the RAM modules. This translation is done by the Memory Management Unit (MMU).
内存管理将 RAM 分配给进程和操作系统本身,确保高效使用和保护。操作系统将程序生成的逻辑地址转换为 RAM 模块上的物理地址。这个转换由内存管理单元(MMU)完成。
Common allocation strategies include contiguous allocation, paging, and segmentation. Contiguous allocation suffers from external fragmentation. Paging divides memory into fixed‑size pages and physical memory into frames, eliminating external fragmentation but introducing internal fragmentation.
常见的分配策略包括连续分配、分页和分段。连续分配存在外部碎片问题。分页将内存划分为固定大小的页面,物理内存划分为帧,消除了外部碎片,但引入了内部碎片。
8. Virtual Memory and Paging | 虚拟内存与分页
Virtual memory allows the execution of processes that may not be completely in memory. It extends the apparent size of RAM by using disk space as an extension. When the CPU accesses a page not in physical memory, a page fault occurs, triggering the OS to load the missing page from disk.
虚拟内存允许执行可能未完全在内存中的进程。它通过使用磁盘空间作为扩展来增加 RAM 的可见大小。当 CPU 访问不在物理内存中的页面时,发生页面错误,触发操作系统从磁盘加载缺失的页面。
Page replacement algorithms like FIFO, LRU (Least Recently Used), and Optimal are used to decide which page to swap out when free frames are scarce. The use of virtual memory enables multitasking with limited physical RAM but can cause thrashing if the system continuously swaps pages.
页面置换算法如 FIFO、LRU(最近最少使用)和最佳算法用于决定当空闲帧不足时换出哪个页面。虚拟内存的使用使得在有限物理 RAM 下实现多任务成为可能,但如果系统不断交换页面,可能会导致抖动。
9. File Systems | 文件系统
The file system organises data on storage devices. It provides a hierarchical structure of directories and files, along with metadata such as file size, permissions, and timestamps. Common file systems include NTFS (Windows), ext4 (Linux), and FAT32 (removable media).
文件系统组织存储设备上的数据。它提供目录和文件的层次结构,以及文件大小、权限和时间戳等元数据。常见文件系统包括 NTFS(Windows)、ext4(Linux)和 FAT32(可移动介质)。
Files can be accessed sequentially or directly. The OS maintains a file allocation table or inode structure to map logical file blocks to physical disk blocks. File permissions control read, write, and execute access for users and groups, contributing to overall system security.
文件可以顺序访问或直接访问。操作系统维护文件分配表或 inode 结构,将逻辑文件块映射到物理磁盘块。文件权限控制用户和组的读、写和执行访问,有助于整体系统安全。
10. Input/Output Management | 输入/输出管理
I/O management handles communication between the CPU and peripheral devices. Device drivers are OS modules that control specific hardware, translating generic I/O requests into device‑specific commands. The OS uses buffering, caching, and spooling to improve performance.
输入/输出管理处理 CPU 与外围设备之间的通信。设备驱动程序是控制特定硬件的操作系统模块,将通用的 I/O 请求转换为设备特定的命令。操作系统使用缓冲、缓存和假脱机来提高性能。
Interrupts are crucial for I/O. When a device completes an operation, it sends an interrupt signal to the CPU. The CPU suspends the current task, runs an interrupt service routine (ISR), and then resumes. This avoids the inefficient use of polling, where the CPU constantly checks device status.
中断对 I/O 至关重要。当设备完成操作时,它向 CPU 发送中断信号。CPU 暂停当前任务,运行中断服务程序(ISR),然后恢复。这避免了轮询的低效使用,轮询需要 CPU 不断检查设备状态。
11. Concurrency and Deadlock | 并发与死锁
Concurrency occurs when multiple processes or threads execute at the same time. The OS must manage access to shared resources to prevent race conditions. Synchronisation mechanisms like semaphores, mutexes, and monitors ensure mutual exclusion.
当多个进程或线程同时执行时,就会发生并发。操作系统必须管理对共享资源的访问,以防止竞争条件。同步机制如信号量、互斥锁和管程确保互斥。
A deadlock arises when a set of processes are each waiting for resources held by another, creating a circular wait. Four necessary conditions for deadlock are mutual exclusion, hold and wait, no pre‑emption, and circular wait. Deadlock can be prevented, avoided, or detected and recovered from.
当一组进程各自等待另一个进程持有的资源时,就会产生死锁,形成循环等待。死锁的四个必要条件是互斥、持有并等待、不可抢占和循环等待。死锁可以预防、避免,或者检测并从中恢复。
12. Protection and Security | 保护与安全
The OS must protect system resources from unauthorised access. Protection mechanisms include user authentication, access control lists (ACLs), and capabilities. The processor operates in two modes: user mode and kernel (supervisor) mode, restricting privileged instructions to the kernel.
操作系统必须保护系统资源免受未经授权的访问。保护机制包括用户身份验证、访问控制列表(ACL)和能力。处理器有两种工作模式:用户模式和内核(特权)模式,将特权指令限制在内核中。
Security goes beyond protection, defending against external threats like viruses, worms, and intrusions. A secure OS employs firewalls, encryption, secure boot, and regular patches to maintain integrity, confidentiality, and availability (CIA triad).
安全性超越了保护,防御病毒、蠕虫和入侵等外部威胁。安全的操作系统采用防火墙、加密、安全启动和定期补丁来维护完整性、机密性和可用性(CIA 三元组)。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图