📚 Operating System Key Concepts for IB & CIE Computer Science | IB CIE 计算机:操作系统 考点精讲
An operating system (OS) is the most fundamental software layer that manages hardware resources and provides services for application programs. For students preparing for IB and CIE Computer Science examinations, a thorough understanding of OS principles—ranging from process scheduling and memory management to file systems and concurrency control—is absolutely essential. This article systematically unpacks the most critical OS concepts you are likely to encounter, presenting each one in clear English–Chinese paired explanations designed specifically for revision.
操作系统(OS)是管理硬件资源并为应用程序提供服务的底层基础软件。对于备战IB和CIE计算机科学考试的学生而言,透彻理解从进程调度、内存管理到文件系统、并发控制等操作系统原理至关重要。本文系统梳理了最关键的OS考点,以英中双语对照的形式清晰呈现,专为复习设计。
1. Operating System Fundamentals | 操作系统基础
An operating system acts as an intermediary between the user and the computer hardware. Its primary roles are to manage resources such as the CPU, memory, storage, and I/O devices, to provide a convenient environment for executing programs, and to ensure efficient and fair use of the system. The two major components are the kernel, which resides permanently in memory and handles low-level tasks, and the shell or user interface, which allows user interaction. OS types include single-tasking, multi-tasking, real-time, distributed, and embedded systems. Understanding the layered architecture—hardware, kernel, system calls, shell, and applications—is essential for both IB and CIE syllabi.
操作系统充当用户与计算机硬件之间的中介。其主要角色是管理CPU、内存、存储和I/O设备等资源,为程序执行提供便利的环境,并确保系统高效且公平地使用。两个主要组件是内核(常驻内存,处理底层任务)和外壳或用户界面(允许用户交互)。OS类型包括单任务、多任务、实时、分布式和嵌入式系统。理解分层架构——硬件、内核、系统调用、外壳和应用程序——对于IB和CIE课程都至关重要。
2. Process Management | 进程管理
A process is a program in execution, including the program code, current activity represented by the program counter, and allocated resources. The OS maintains a Process Control Block (PCB) for each process containing process ID, state, registers, memory limits, and I/O status. Process states include New, Ready, Running, Blocked (Waiting), and Terminated. Context switching occurs when the CPU saves the state of the current process and loads the state of another, allowing multitasking. Both IB and CIE expect you to be able to draw and interpret a process state transition diagram.
进程是正在执行的程序,包含程序代码、由程序计数器表示的当前活动以及分配的资源。OS为每个进程维护一个进程控制块(PCB),其中包含进程ID、状态、寄存器、内存限制和I/O状态。进程状态包括新建、就绪、运行、阻塞(等待)和终止。当CPU保存当前进程的状态并加载另一个进程的状态时,发生上下文切换,从而允许多任务处理。IB和CIE都要求你能够绘制并解释进程状态转换图。
3. Process Scheduling | 进程调度
CPU scheduling determines which ready process is allocated the CPU next. Key criteria include CPU utilisation, throughput, turnaround time, waiting time, and response time. Preemptive scheduling allows a running process to be interrupted, while non-preemptive scheduling runs a process to completion or until it blocks. Common algorithms include First Come First Served (FCFS), Shortest Job First (SJF), Priority Scheduling, and Round Robin (RR). You should be able to calculate average waiting times and recognise the starvation problem in priority-based algorithms—often solved by aging. Multilevel queue and multilevel feedback queue are advanced structures related to real-world OS implementations.
CPU调度决定下一个将CPU分配给哪个就绪进程。关键指标包括CPU利用率、吞吐量、周转时间、等待时间和响应时间。抢占式调度允许运行中的进程被中断,而非抢占式调度则让进程运行到完成或阻塞为止。常见算法包括先来先服务(FCFS)、最短作业优先(SJF)、优先级调度和轮转调度(RR)。你应该能够计算平均等待时间,并识别基于优先级算法中的饥饿问题——通常通过老化解决。多级队列和多级反馈队列是与现实操作系统实现相关的高级结构。
4. Memory Management | 内存管理
Memory management is responsible for allocating main memory to processes and reclaiming it when no longer needed. Key concepts include logical vs physical address space, binding of addresses at compile, load, or execution time, and the use of a memory management unit (MMU) for address translation. Contiguous allocation schemes include fixed partitions and variable partitions, suffering from internal and external fragmentation respectively. Paging divides memory into fixed-size frames and processes into pages, eliminating external fragmentation. Segmentation divides a program into logical segments of varying lengths, reflecting the user’s view. IB and CIE both require understanding of page tables and the translation lookaside buffer (TLB).
内存管理负责将主存分配给进程,并在不再需要时回收。关键概念包括逻辑地址与物理地址空间、地址在编译时、加载时或执行时的绑定,以及内存管理单元(MMU)进行地址转换的使用。连续分配方案包括固定分区和可变分区,分别存在内部碎片和外部碎片。分页将内存划分为固定大小的帧,将进程划分为页,从而消除外部碎片。分段将程序划分为长度可变的逻辑段,反映用户的视角。IB和CIE都要求理解页表和转换后备缓冲器(TLB)。
5. Virtual Memory | 虚拟内存
Virtual memory is a technique that allows execution of processes that are not completely in main memory, by using secondary storage as an extension of RAM. This enables the logical address space to be much larger than physical memory. It is implemented via demand paging or demand segmentation. A page fault occurs when the requested page is not in memory, requiring it to be fetched from disk. Page replacement algorithms decide which page to evict; common ones include FIFO, Optimal, and LRU (Least Recently Used). Thrashing, a severe performance collapse caused by high paging activity, is an important concept for both examinations. CIE frequently asks about the working set model or the relationship between page fault rate and allocated frames.
虚拟内存是一种技术,允许执行不完全在主存中的进程,通过将辅助存储作为RAM的扩展来使用。这使得逻辑地址空间可以远大于物理内存。它通过请求分页或请求分段实现。当请求的页面不在内存中时,发生缺页中断,需要从磁盘获取。页面置换算法决定淘汰哪个页面;常见的有FIFO、Optimal和LRU(最近最少使用)。抖动是由于高页面调度活动导致的严重性能下降,是两项考试的重要概念。CIE常问及工作集模型或缺页率与分配帧数之间的关系。
6. File System | 文件系统
The file system provides a logical view of information storage, abstracting physical properties of storage devices. Files are logical storage units, and directories organise files into a hierarchical structure. File attributes include name, type, location, size, protection, and timestamps. Access methods can be sequential or direct. The file system must manage free space using techniques like free-space lists, bitmaps, or linked lists. Disk scheduling algorithms (FCFS, SSTF, SCAN, C-SCAN, LOOK) reduce seek time. Both IB and CIE expect knowledge of file allocation methods: contiguous, linked, and indexed allocation, with their respective advantages and disadvantages regarding fragmentation and access speed.
文件系统提供信息存储的逻辑视图,抽象了存储设备的物理特性。文件是逻辑存储单元,目录将文件组织成分层结构。文件属性包括名称、类型、位置、大小、保护和时间戳。访问方法可以是顺序的或直接的。文件系统必须使用空闲空间列表、位图或链表等技术管理空闲空间。磁盘调度算法(FCFS、SSTF、SCAN、C-SCAN、LOOK)可减少寻道时间。IB和CIE都要求了解文件分配方法:连续分配、链接分配和索引分配,以及它们在碎片和访问速度方面各自的优缺点。
7. Input/Output (I/O) Management | 输入/输出管理
I/O management hides the complexity of hardware devices behind a uniform interface. The I/O subsystem uses device drivers, which are kernel-resident modules specific to each hardware device. Three main I/O techniques are programmed I/O, interrupt-driven I/O, and Direct Memory Access (DMA). In programmed I/O the CPU polls the device continuously; interrupt-driven I/O allows the CPU to attend to other tasks and be interrupted when the device is ready; DMA transfers blocks of data between memory and a device without continuous CPU involvement. Spooling (Simultaneous Peripheral Operations On-Line) is used to manage output to slow devices such as printers. IB may test on the function of device controllers and the layered I/O software structure.
I/O管理将硬件设备的复杂性隐藏在一个统一的接口之后。I/O子系统使用设备驱动程序,这是特定于每个硬件设备的内核驻留模块。三种主要的I/O技术是程序控制I/O、中断驱动I/O和直接内存访问(DMA)。在程序控制I/O中,CPU持续轮询设备;中断驱动I/O允许CPU处理其他任务,并在设备就绪时被中断;DMA在内存和设备之间传输数据块,而无需CPU持续参与。假脱机(Simultaneous Peripheral Operations On-Line)用于管理向慢速设备(如打印机)的输出。IB可能测试设备控制器的功能以及分层的I/O软件结构。
8. Concurrency and Synchronization | 并发与同步
Concurrency arises when multiple processes or threads execute simultaneously, possibly sharing data. Race conditions occur when the outcome depends on the relative timing of events, leading to inconsistent results. Critical sections are code segments that access shared resources and must be executed atomically. Synchronization mechanisms include mutex locks, semaphores (binary and counting), and monitors. Classic problems such as the Producer-Consumer, Readers-Writers, and Dining Philosophers illustrate the need for careful coordination. Deadlock avoidance and prevention are distinct from concurrency control; CIE expects familiarity with semaphore operations wait (P) and signal (V), and the conditions for a good solution: mutual exclusion, progress, and bounded waiting.
当多个进程或线程同时执行,可能共享数据时,就出现了并发。竞争条件是指结果取决于事件的相对时间顺序,导致不一致的结果。临界区是访问共享资源的代码段,必须原子执行。同步机制包括互斥锁、信号量(二进制和计数)以及管程。生产者-消费者、读者-写者和哲学家就餐等经典问题说明了仔细协调的必要性。死锁避免和预防与并发控制是不同的;CIE要求熟悉信号量操作wait (P) 和signal (V),以及良好解决方案的条件:互斥、进展和有限等待。
9. Deadlock | 死锁
Deadlock is a situation where a set of processes are each waiting for an event that only another process in the set can cause. Four necessary conditions must hold: mutual exclusion, hold and wait, no preemption, and circular wait. Handling strategies include prevention (negating at least one condition), avoidance (e.g., Banker’s algorithm by ensuring a safe state), detection and recovery (killing processes or rolling back), and the ostrich algorithm (ignoring the problem). The resource allocation graph is a useful tool to identify deadlocks: a cycle may indicate deadlock if resources have single instances. IB and CIE examinations frequently present scenarios requiring identification of the deadlock conditions or a demonstration of the Banker’s algorithm.
死锁是指一组进程中的每一个都在等待一个只有该组中另一个进程才能引发的事件的情况。四个必要条件必须同时成立:互斥、保持并等待、不可抢占和循环等待。处理策略包括预防(否定至少一个条件)、避免(例如银行家算法,确保安全状态)、检测与恢复(终止进程或回滚)以及鸵鸟算法(忽略问题)。资源分配图是识别死锁的有用工具:如果资源只具有单个实例,循环可能表明死锁。IB和CIE考试经常呈现需要识别死锁条件或演示银行家算法的情景。
10. Interrupts and System Calls | 中断与系统调用
Interrupts are signals sent by hardware or software to the CPU, indicating an event that needs immediate attention. When an interrupt occurs, the CPU suspends its current activity, saves its state, and executes an interrupt service routine (ISR). After handling, it resumes the original task. Interrupts can be maskable or non-maskable, and they enable efficient I/O and multitasking. System calls are the programming interface between user programs and OS kernel; they allow user processes to request services such as file operations, process control, and communication. The transition from user mode to kernel mode is triggered by a system call or an interrupt using a trap instruction. CIE expects knowledge of the interrupt cycle and the role of the interrupt vector table.
中断是由硬件或软件向CPU发送的信号,指示需要立即关注的事件。当中断发生时,CPU暂停当前活动,保存其状态,并执行中断服务程序(ISR)。处理后,恢复原任务。中断可以是可屏蔽的或不可屏蔽的,它们实现了高效的I/O和多任务处理。系统调用是用户程序与OS内核之间的编程接口;它们允许用户进程请求服务,例如文件操作、进程控制和通信。从用户模式到内核模式的转换由系统调用或使用陷阱指令的中断触发。CIE要求了解中断周期和中断向量表的作用。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply