Operating Systems Revision Guide for IB and WJEC Computer Science | IB WJEC 计算机:操作系统 考点精讲

📚 Operating Systems Revision Guide for IB and WJEC Computer Science | IB WJEC 计算机:操作系统 考点精讲

Operating systems form the essential bridge between hardware and user applications. Mastery of OS concepts is vital for IB and WJEC Computer Science, covering resource management, process scheduling, memory allocation, and file systems. This bilingual revision guide highlights key topics, typical exam questions, and the core knowledge you need to succeed.

操作系统是硬件与用户应用之间的关键桥梁。掌握操作系统概念对于 IB 和 WJEC 计算机科学考试至关重要,涵盖资源管理、进程调度、内存分配和文件系统。本篇双语考点精讲突出重点主题、常见考题和必备核心知识,助你高效备考。

1. Role and Functions of an Operating System | 操作系统的角色与功能

An operating system acts as an intermediary between the user and computer hardware, providing an environment to run programs conveniently and efficiently. It manages resources like the processor, memory, storage, and I/O devices. The OS also offers abstraction through system calls, enabling applications to interact with hardware without knowing low-level details.

操作系统充当用户与计算机硬件之间的中介,提供一个方便高效地运行程序的环境。它管理处理器、内存、存储和 I/O 设备等资源。操作系统还通过系统调用提供抽象,使应用程序无需了解底层细节即可与硬件交互。

The kernel is the core component, always resident in memory, handling process scheduling, memory management, and device drivers. The shell provides a user interface, either command-line (CLI) or graphical (GUI). Common functions include booting, multitasking, security enforcement, and error detection.

内核是操作系统的核心组件,始终驻留在内存中,负责进程调度、内存管理和设备驱动程序。外壳提供用户界面,可以是命令行界面 (CLI) 或图形用户界面 (GUI)。常见功能包括启动、多任务处理、安全执行和错误检测。


2. Process Management and Scheduling | 进程管理与调度

A process is a program in execution, with its own address space, program counter, and state. The OS maintains a process control block (PCB) to store process metadata. Processes transition between states: new, ready, running, waiting, and terminated. Context switching saves the state of the currently running process and loads the next one, enabling multitasking.

进程是正在执行的程序,拥有自己的地址空间、程序计数器和状态。操作系统维护进程控制块(PCB)以存储进程元数据。进程在新建、就绪、运行、等待和终止五种状态之间转换。上下文切换保存当前运行进程的状态并加载下一个,实现多任务处理。

Scheduling algorithms determine which ready process gets CPU time. Preemptive algorithms like Round Robin (RR) allocate fixed time slices to ensure fairness, while non-preemptive algorithms like First Come First Served (FCFS) and Shortest Job First (SJF) rely on the process’s arrival or burst time. Priority scheduling can be preemptive or non-preemptive, with risks of starvation for low-priority processes.

调度算法决定哪个就绪进程获得 CPU 时间。抢占式算法如轮转调度 (RR) 分配固定的时间片以确保公平,而非抢占式算法如先来先服务 (FCFS) 和最短作业优先 (SJF) 则依据进程的到达时间或执行时间。优先级调度可以是抢占式或非抢占式,存在低优先级进程饥饿的风险。


3. Threads and Concurrency | 线程与并发

A thread is a lightweight unit of execution within a process. Threads share the same memory space and resources, making context switching between threads cheaper than between processes. Multithreading improves responsiveness and resource sharing, but introduces challenges like race conditions and deadlocks when threads share data.

线程是进程内的轻量级执行单元。线程共享相同的内存空间和资源,因此线程之间的上下文切换比进程间切换开销更低。多线程提高了响应速度和资源共享,但当线程共享数据时会引入竞争条件和死锁等挑战。

Concurrency control mechanisms include mutex locks, semaphores, and monitors. A mutex ensures only one thread accesses a critical section at a time. Semaphores use wait and signal operations to manage access to limited resources. Deadlock occurs when processes are waiting for resources held by each other, requiring prevention, avoidance, or detection strategies.

并发控制机制包括互斥锁、信号量和管程。互斥锁确保一次只有一个线程访问临界区。信号量使用等待和信号操作来管理有限资源的访问。死锁发生在进程相互等待对方持有的资源时,需要预防、避免或检测策略来解决。


4. Memory Management | 内存管理

Memory management handles allocation and deallocation of main memory to processes, ensuring efficient use and protection between processes. Logical addresses are translated to physical addresses by the memory management unit (MMU) using relocation registers. Basic techniques include fixed partitioning and dynamic partitioning, which can lead to external fragmentation.

内存管理负责为主存中的进程分配和回收内存,确保高效使用和进程间保护。逻辑地址通过内存管理单元 (MMU) 使用重定位寄存器转换为物理地址。基本技术包括固定分区和动态分区,但动态分区可能导致外部碎片。

Paging eliminates external fragmentation by dividing memory into fixed-size frames and processes into pages of the same size. A page table maps each page to a frame, enabling non-contiguous allocation. Segmentation divides memory into logical segments of varying sizes, reflecting the program’s structure, but can cause external fragmentation. Virtual memory extends logical memory beyond physical RAM using demand paging and page replacement algorithms like FIFO, LRU, and Clock.

分页通过将内存划分为固定大小的帧、进程划分为相同大小的页来消除外部碎片。页表将每个页面映射到一个帧,实现非连续分配。分段将内存划分为不同大小的逻辑段,反映程序的结构,但可能导致外部碎片。虚拟内存通过请求调页和页替换算法(如 FIFO、LRU 和 Clock)将逻辑内存扩展到物理 RAM 之外。


5. Virtual Memory and Page Replacement | 虚拟内存与页面置换

Virtual memory allows execution of processes that are not completely in memory, giving the illusion of a larger address space. This is achieved through demand paging, where pages are loaded only when needed, triggered by a page fault. The effective access time depends on the page fault rate and paging device speed.

虚拟内存允许执行未完全装入内存的进程,营造了更大地址空间的幻象。这是通过请求调页实现的,即页面仅在需要时加载,由缺页中断触发。有效访问时间取决于缺页率和调页设备的速度。

Page replacement algorithms decide which page to evict when a frame is needed. First-In, First-Out (FIFO) is simple but can suffer from Belady’s anomaly. Optimal (OPT) is theoretical and used for comparison. Least Recently Used (LRU) uses recent history but is harder to implement. The Clock (second chance) algorithm is a practical approximation of LRU, using a reference bit and a circular buffer.

页面置换算法决定在需要帧时淘汰哪个页面。先进先出 (FIFO) 简单但可能出现 Belady 异常。最优置换 (OPT) 是理论上的,用于比较。最近最少使用 (LRU) 根据最近历史置换,但较难实现。时钟算法(第二次机会)是 LRU 的实际近似,使用引用位和循环缓冲区。


6. File Systems and Storage | 文件系统与存储

A file system organises data on storage devices, providing a logical structure of files and directories. It handles file naming, access control, and allocation of storage blocks. Common allocation methods include contiguous, linked, and indexed allocation. Contiguous allocation is simple and fast but suffers from external fragmentation. Linked allocation avoids fragmentation but is slow for random access. Indexed allocation uses an index block to store pointers to all data blocks, combining benefits of both.

文件系统组织存储设备上的数据,提供文件和目录的逻辑结构。它处理文件命名、访问控制和存储块的分配。常见的分配方法包括连续分配、链接分配和索引分配。连续分配简单快速,但存在外部碎片。链接分配避免碎片,但随机访问慢。索引分配使用索引块存储所有数据块的指针,结合了两者的优点。

Directory structures include single-level, two-level, tree-structured, and acyclic-graph directories. The OS manages free space using bit vectors, linked lists, or grouping. File permissions (read, write, execute) and access control lists (ACLs) ensure security. Disk scheduling algorithms like FCFS, SSTF, SCAN, C-SCAN reduce seek time.

目录结构包括单级、两级、树形结构和无环图目录。操作系统使用位向量、链表或成组链接管理空闲空间。文件权限(读、写、执行)和访问控制列表 (ACL) 确保安全。磁盘调度算法如 FCFS、SSTF、SCAN、C-SCAN 减少寻道时间。


7. Device Management and I/O | 设备管理与输入输出

The OS manages I/O devices through device drivers, which translate generic OS commands into device-specific operations. I/O can be programmed (polling), interrupt-driven, or use direct memory access (DMA) for high-speed transfers. Buffering and caching improve performance by smoothing speed mismatches between CPU and devices.

操作系统通过设备驱动程序管理 I/O 设备,驱动程序将通用操作系统命令转换为设备特定操作。I/O 可以是程序控制(轮询)、中断驱动或使用直接内存访问 (DMA) 进行高速传输。缓冲和缓存通过平滑 CPU 与设备之间的速度差异来提高性能。

Spooling is used for devices like printers, where output is stored on disk and serviced asynchronously. The OS also handles device sharing, reservation, and error handling. In IB and WJEC, understanding the driver architecture and the DMA controller’s role in bypassing the CPU during data transfer is essential.

假脱机用于打印机等设备,输出存储在磁盘上并异步处理。操作系统还负责设备共享、预留和错误处理。在 IB 和 WJEC 考试中,理解驱动程序架构以及 DMA 控制器在数据传输中绕过 CPU 的作用至关重要。


8. Security and Protection | 安全与保护

Protection mechanisms control access to resources by processes and users. The OS enforces access rights via access matrices, capability lists, or role-based access control. Authentication confirms user identity through passwords, biometrics, or multi-factor methods.

保护机制控制进程和用户对资源的访问。操作系统通过访问矩阵、权限列表或基于角色的访问控制来执行访问权限。认证通过密码、生物识别或多因素方法确认用户身份。

Common threats include malware (viruses, worms, trojans), denial-of-service attacks, and privilege escalation. Protection involves firewalls, antivirus software, and sandboxing. The principle of least privilege ensures that each user or process has only the minimum access necessary to perform its tasks.

常见威胁包括恶意软件(病毒、蠕虫、木马)、拒绝服务攻击和权限提升。保护涉及防火墙、防病毒软件和沙盒。最小权限原则确保每个用户或进程仅拥有执行任务所需的最小访问权限。


9. Virtualisation and Cloud OS Concepts | 虚拟化与云操作系统概念

Virtualisation allows multiple operating systems to run concurrently on a single physical machine via a hypervisor. Type 1 hypervisors run directly on hardware, while Type 2 runs on a host OS. Virtual machines provide isolation, resource control, and ease of migration, which underpin cloud computing.

虚拟化允许多个操作系统通过 hypervisor 在单台物理机器上并发运行。Type 1 hypervisor 直接运行在硬件上,Type 2 则运行在宿主操作系统上。虚拟机提供隔离、资源控制和易于迁移的特性,这构成了云计算的基础。

Cloud OS concepts involve delivering computing services over the internet, with layers like IaaS (Infrastructure as a Service), PaaS (Platform as a Service), and SaaS (Software as a Service). The exam may ask about the benefits of virtualisation, such as server consolidation and fault tolerance.

云操作系统概念涉及通过互联网提供计算服务,包含 IaaS(基础设施即服务)、PaaS(平台即服务)和 SaaS(软件即服务)等层次。考试可能询问虚拟化的优势,如服务器整合和容错。


10. Exam Tips and Common Pitfalls | 考试技巧与常见误区

IB and WJEC exams often test OS concepts through scenario-based questions. Be prepared to compare scheduling algorithms by calculating average waiting time and turnaround time. Practice drawing Gantt charts for FCFS, SJF, RR, and priority scheduling. Do not confuse paging with segmentation: paging is fixed-size, invisible to the programmer; segmentation is variable, logical, and visible.

IB 和 WJEC 考试常通过情境题测试操作系统概念。要准备好通过计算平均等待时间和周转时间来比较调度算法。练习为 FCFS、SJF、RR 和优先级调度绘制甘特图。不要混淆分页和分段:分页是固定大小的,对程序员透明;分段是可变大小的、逻辑的、编程可见。

For memory management, clearly explain how virtual memory uses page tables, TLBs, and swap space. When describing deadlock, always mention the four necessary conditions (mutual exclusion, hold and wait, no preemption, circular wait) and how to break them. Use precise terminology in essays, such as “context switch overhead”, “internal fragmentation”, and “Belady’s anomaly”.

对于内存管理,要清楚解释虚拟内存如何使用页表、TLB 和交换空间。描述死锁时,务必提及四个必要条件(互斥、持有并等待、不可抢占、循环等待)以及如何打破它们。在论文中使用准确术语,如“上下文切换开销”、“内部碎片”和“Belady 异常”。


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