IB Computer Science: Operating Systems Exam Review | IB 计算机:操作系统 考点精讲

📚 IB Computer Science: Operating Systems Exam Review | IB 计算机:操作系统 考点精讲

In IB Computer Science, grasping how an operating system works is fundamental to understanding the interaction between software and hardware. This bilingual revision guide unpacks key topics – from process management to virtualization – to help you master exam content effectively.

在 IB 计算机科学中,理解操作系统如何工作是掌握软硬件交互的基础。这份双语考点精讲将剖析进程管理、虚拟化等核心主题,帮助你高效掌握考试内容。

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

An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for application programs.

操作系统(OS)是一组管理计算机硬件资源并为应用程序提供通用服务的软件。

Key roles include acting as an intermediary between users and hardware, allocating resources, and ensuring the system runs efficiently and securely.

其核心角色包括充当用户与硬件之间的中介、分配资源,并确保系统高效安全地运行。

Major OS functions: process management, memory management, file system management, I/O device management, and protection/security.

主要 OS 功能:进程管理、内存管理、文件系统管理、I/O 设备管理以及保护与安全。


2. Process Management | 进程管理

A process is a program in execution. It consists of the program code, current activity, stack, and data section.

进程是执行中的程序,包含程序代码、当前活动、栈和数据段。

Each process is represented by a Process Control Block (PCB) containing its state, program counter, CPU registers, and memory limits.

每个进程由一个进程控制块(PCB)表示,内含进程状态、程序计数器、CPU 寄存器和内存界限。

Process states: New, Ready, Running, Waiting, Terminated. Transitions between states are triggered by events like interrupts or scheduler decisions.

进程状态:新建、就绪、运行、等待、终止。状态间的转换由中断或调度程序决策等事件触发。

New → Ready → Running → Terminated | Running → Waiting → Ready


3. Threads and Concurrency | 线程与并发

A thread is the smallest unit of execution within a process. Multiple threads share the same address space and resources, enabling efficient multitasking.

线程是进程内的最小执行单元。多线程共享同一地址空间和资源,实现高效多任务。

Concurrency issues, such as race conditions, arise when threads access shared data without synchronization. Mutual exclusion (mutex) locks and semaphores prevent data inconsistency.

当线程无同步地访问共享数据时,会出现竞态条件等并发问题。互斥锁(mutex)和信号量可防止数据不一致。

Benefits: responsiveness, resource sharing, economy, and scalability on multi-core systems.

线程优势:响应性、资源共享、经济性以及在多核系统上的可扩展性。


4. CPU Scheduling | CPU 调度

The CPU scheduler selects which process runs next from the ready queue to maximize CPU utilization and minimize waiting time.

CPU 调度程序从就绪队列中选择下一个要运行的进程,以最大化 CPU 利用率并最小化等待时间。

Common algorithms include First-Come, First-Served (FCFS), Shortest Job First (SJF), Priority Scheduling, and Round Robin (RR).

常见算法包括先来先服务(FCFS)、最短作业优先(SJF)、优先级调度和轮转调度(RR)。

Algorithm Type Advantage Disadvantage
FCFS Non-preemptive Simple, fair Convoy effect
SJF Non-preemptive / preemptive Minimum average waiting time Starvation
Priority Preemptive or non Supports priority processes Starvation, aging needed
Round Robin Preemptive Fair, good response time Overhead due to time quantum

For FCFS with burst times 24, 3, 3 ms, the average waiting time = (0 + 24 + 27) / 3 = 17 ms.

对于执行时间为 24、3、3 毫秒的 FCFS,平均等待时间 = (0 + 24 + 27) / 3 = 17 毫秒。


5. Memory Management | 内存管理

Memory management allocates RAM to processes efficiently, using schemes like contiguous allocation, paging, and segmentation.

内存管理通过连续分配、分页和分段等方式高效地将 RAM 分配给进程。

In paging, logical memory is divided into fixed-sized pages, and physical memory is divided into frames. A page table maps page numbers to frame numbers.

分页中,逻辑内存被划分为固定大小的页,物理内存划分为帧。页表将页码映射到帧号。

Physical Address = Frame_number × Page_size + Offset

Segmentation divides memory into variable-sized logical units (code, stack, heap) defined by base and limit registers.

分段将内存划分为可变大小的逻辑单元(代码、栈、堆),由基址和界限寄存器定义。


6. Virtual Memory | 虚拟内存

Virtual memory allows execution of processes not completely in memory by using disk space as an extension of RAM, enabling larger programs and multiprogramming.

虚拟内存利用磁盘空间作为内存扩展,允许执行未完全载入内存的进程,从而支持更大的程序和多道程序设计。

Demand paging loads pages only when needed. A page fault occurs when a required page is not in memory and must be fetched from disk.

按需调页仅在需要时载入页面。当所需页面不在内存中而必须从磁盘读取时,发生缺页中断。

Page replacement algorithms: FIFO, Optimal, LRU. Example reference string: 1,2,3,4,1,2,5,1,2,3,4,5. With 3 frames, LRU yields fewer faults than FIFO.

页面置换算法:FIFO、最优、LRU。例如引用串:1,2,3,4,1,2,5,1,2,3,4,5。使用 3 个帧,LRU 的缺页次数少于 FIFO。

Page fault rate = Number of page faults / Total memory accesses


7. File Systems | 文件系统

A file system organizes and stores files on storage devices. It provides naming, access control, and data management.

文件系统组织和存储存储设备上的文件,提供命名、访问控制和数据管理功能。

Common allocation methods: contiguous (simple, fast but external fragmentation), linked (no fragmentation but slow direct access), and indexed (stores block pointers in an index block, faster random access).

常见分配方式:连续分配(简单快速但有外部碎片),链接分配(无碎片但直接访问慢),索引分配(在索引块中存指针,随机访问快)。

Directory structures range from single-level to tree-structured, allowing hierarchical organization. Metadata stored in inode includes permissions, timestamps, and data block pointers.

目录结构从单级到树形,支持分层组织。inode 中存储元数据,包括权限、时间戳和数据块指针。


8. I/O Management | 输入/输出管理

The I/O subsystem handles communication between the CPU and peripheral devices. Device drivers abstract hardware specifics for the OS.

I/O 子系统处理 CPU 与外设之间的通信。设备驱动程序为操作系统抽象硬件细节。

Three I/O techniques: programmed I/O (busy-waiting), interrupt-driven I/O (CPU interrupted on completion), and Direct Memory Access (DMA) which offloads data transfer to a controller.

三种 I/O 技术:程序控制 I/O(忙等)、中断驱动 I/O(完成时中断 CPU)、直接存储器访问(DMA),由控制器负责数据传输。

Spooling (Simultaneous Peripheral Operations On-Line) queues output for devices like printers, allowing processes to continue without waiting.

假脱机(Spooling)为打印机等设备排队输出,使进程无需等待即可继续执行。


9. Security and Protection | 安全与保护

Protection mechanisms control access to system resources by users and processes. The access matrix model defines domains, objects, and rights.

保护机制控制用户和进程对系统资源的访问。访问矩阵模型定义了域、对象和权限。

Authentication verifies user identity through passwords, biometrics, or multi-factor methods. Encryption safeguards data confidentiality.

身份验证通过口令、生物特征或多因素方法验证用户身份。加密保障数据机密性。

Malware defense includes firewalls, antivirus, and least-privilege principle. OS audits logs monitor suspicious activity.

恶意软件防御包括防火墙、反病毒和最小权限原则。操作系统审计日志监视可疑活动。


10. Virtualization | 虚拟化

Virtualization creates virtual versions of hardware, storage, or network resources, enabling multiple OS instances to run on a single physical machine.

虚拟化创建硬件、存储或网络资源的虚拟版本,允许多个操作系统实例在同一物理机上运行。

A hypervisor (Virtual Machine Monitor) manages VMs. Type 1 runs directly on hardware (bare-metal), while Type 2 runs on a host OS.

Hypervisor(虚拟机监视器)管理 VM。Type 1 直接运行在硬件上(裸机),Type 2 运行在宿主操作系统上。

Benefits: server consolidation, isolation, testing environments, and live migration. Used extensively in cloud computing.

优点:服务器整合、隔离、测试环境和实时迁移。在云计算中广泛使用。


11. Real-Time Operating Systems | 实时操作系统

A real-time operating system (RTOS) guarantees response within strict time constraints. Hard real-time systems require absolute deadlines; soft real-time tolerates occasional misses.

实时操作系统(RTOS)保证在严格的时间约束内响应。硬实时系统要求绝对截止时间;软实时允许偶尔错过。

RTOS employs priority-based preemptive scheduling, minimal interrupt latency, and deterministic behavior. Used in embedded systems, robotics, and avionics.

RTOS 采用基于优先级的抢占调度、最小中断延迟和确定性行为。应用于嵌入式系统、机器人和航空电子。


12. Interrupts | 中断

An interrupt is a signal to the processor indicating an event that needs immediate attention, allowing the OS to respond asynchronously to hardware or software events.

中断是发给处理器的信号,指示需要立即处理的事件,使操作系统能异步响应硬件或软件事件。

Hardware interrupts come from devices (e.g., I/O completion, timer). Software interrupts (traps) are caused by program errors or system calls.

硬件中断来自设备(如 I/O 完成、定时器)。软件中断(陷阱)由程序错误或系统调用引起。

The interrupt vector table stores addresses of interrupt service routines (ISRs). Upon receiving an interrupt, the CPU saves state, jumps to the ISR, executes it, and restores state.

中断向量表存储中断服务例程(ISR)地址。接收中断时,CPU 保存状态、跳转到 ISR、执行后恢复状态。

Interrupt lifecycle: Request → Acknowledge → Save context → ISR → Restore → Return


Published by TutorHao | IB 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