Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: 王海鹏 译

Rating No ratings yet

该书是《Operating System :Three Easy Pieces》的中文翻译。但是,里面有些地方翻译的不是很准确,如果读不下去了,就去参照英文原版。

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
# 操作系统导论-OSTEP (王海鹏 译) ## 【One-Line Pitch】 A Chinese translation of the celebrated "Operating Systems: Three Easy Pieces" (OSTEP), this book demystifies operating systems through three conceptual pillars—virtualization, concurrency, and persistence—making it the ideal read for CS students, self-taught programmers, and anyone who wants to truly understand how their computer manages processes, memory, and files. ## 【Book Arc】 - **Opening (~0%–10%)**: Introduces the "three easy pieces" framework and traces OS history from early batch systems through multiprogramming and the PC era, establishing why virtualization, concurrency, and persistence are the core problems every OS must solve. - **Early (~10%–25%)**: Dives into CPU virtualization—process abstraction, the fork()/exec()/wait() API, process states, and the fundamental scheduling algorithms (FIFO, SJF, RR, MLFQ, and lottery scheduling) with hands-on simulator exercises. - **Early-to-Middle (~25%–40%)**: Transitions to memory virtualization, covering address spaces, malloc()/free() APIs, base-and-bounds relocation, segmentation (including reverse-growing stacks), and the basics of paging. - **Middle (~40%–55%)**: Explores advanced paging mechanisms—TLB management across context switches, smaller page tables via hybrid paging/segmentation, and page replacement policies (FIFO, LRU, random) with real-world case studies like VMS. - **Late (~55%–100%)**: Extends into concurrency (locks, condition variables, semaphores) and persistence (I/O, file systems, crash consistency), though the excerpts primarily cover the virtualization half in depth. ## 【Key Takeaways】 - **The OS is a resource manager built on three pillars** (Early): virtualization of CPU and memory, concurrency management, and persistence—this framework organizes the entire book and helps readers see how seemingly disparate topics connect. - **Processes are the fundamental unit of CPU virtualization** (Early): understanding process states (running, ready, blocked) and the fork()/exec()/wait() API is essential—the book's code examples (like p3.c) show exactly how processes are created and replaced. - **Scheduling is about trade-offs, not perfection** (Early): FIFO and SJF optimize turnaround time but hurt response time; Round Robin does the opposite; MLFQ (Multi-Level Feedback Queue) approximates optimal behavior by learning from job behavior—the simulator exercises (scheduler.py, mlfq.py) are the best way to internalize these trade-offs. - **Memory virtualization relies on hardware/OS cooperation** (Early-to-Middle): base-and-bounds registers provide simple relocation, but segmentation adds flexibility (including reverse-growing stacks) at the cost of external fragmentation—the OS must manage free lists and handle exceptions. - **Paging eliminates external fragmentation but introduces overhead** (Middle): fixed-size pages are flexible and support sparse address spaces, but naive implementations cause slow lookups (extra memory accesses) and bloated page tables—this motivates the need for TLB and smaller table designs. - **TLB management is critical for performance** (Middle): the TLB caches virtual-to-physical mappings, but context switches require careful flushing or address-space identifiers to prevent process P2 from using P1's mappings—a subtle bug that can cause catastrophic failures. - **Page replacement policies have no universal winner** (Middle): FIFO and LRU fail badly on cyclic workloads (0% hit rate even with a 49-page cache for 50 pages), while random performs surprisingly well—real systems like VMS use segmented FIFO with second-chance lists to balance fairness and hardware constraints. ## 【Reading Tips】 - **Skim the historical chapters** (~0%–10%): The early OS history is interesting but not critical—focus instead on the "three easy pieces" framework and the key terminology (multiprogramming, time-sharing, memory protection). - **Deep-read the scheduling chapters** (~15%–25%): These are the conceptual heart of CPU virtualization—work through the simulator exercises (scheduler.py, mlfq.py) to truly understand how different policies behave under various workloads. - **Pay special attention to the code examples** (Early): The fork()/exec()/wait() programs (p1.c, p2.c, p3.c) are worth studying line-by-line—they demonstrate the actual system calls that make process creation work. - **Watch for translation issues**: The Chinese translation has known inaccuracies—if a passage feels confusing or contradictory, consult the English original ("Operating Systems: Three Easy Pieces") for clarity. - **Use the "dialogue" chapters as review**: The professor-student conversations (like Chapter 11) summarize key concepts in an accessible format—read them as checkpoints to verify your understanding before moving on. ## 【Coverage Limits】 This guide covers the virtualization portion (CPU and memory) in depth, which is where the excerpts concentrate. The concurrency and persistence sections are mentioned but not detailed in the source material—readers should expect those topics in the latter half of the book. ##
Excerpt 1
.......................................... 117 作业 .......................................................... 118 第 11 章 关于 CPU 虚拟化的总结对话 .. 81 问题 ...............
View in text
Excerpt 2
数程序 wc。实实上,它针对源代码 文件 p3.c 运行 wc,从而告诉我我该文件有多少行、多少单词,以及多少字节。 fork()系统调用很奇怪,它的伙伴 exec()也我一般。给我可执行程序的名称(如 wc)及 需要的参数(如 p3.c)后,exec()会从可执行程序中加载代码和静态数据,并用它覆写自己 的代码...
View in text
Excerpt 3
内存,给其他进程或者操作系统使用。在进程终止时,操作系统会将 这些内存放回到空闲列表,并根据需要清除相关的数据结构。 第三,在上下文切换时,操作系统也必须执行一些额外的操作。每个 CPU 毕竟只有一 个基址寄存器和一个界限寄存器,但对于每个运行的程序,它们的值都不同,因为每个程 序被加载到内存中不同的物理地址。因...
View in text
Excerpt 4
[M28]“Reese’s Peanut Butter Cups”Mars Candy Corporation. 显然,这些精美的“甜点”是由 Harry Burnett Reese 在 1928 年发明的,他以前曾是奶牛场的农夫和 Milton S. Hershey 的运输工长。至少,维基百科上是这么说的。 [...
View in text
Excerpt 5
制谁会获得锁,避免饿死。 你可能注意到,guard 基本上起到了自旋锁的作用,围绕着 flag 和队列操作。因此,这 个方法并没有完全避免自旋等待。线程在获取锁或者释放锁时可能被中断,从而导致其他 线程自旋等待。但是,这个自旋等待时间是很有限的(不是用户定义的临界区,只是在 lock 和 unlock 代码中的几...
View in text
Excerpt 6
mber 1987 分布式数据库系统中死锁检测的极好概述,也指出了一些其他相关的工作,因此是开始阅读的好文章。 [L+08]“Learning from Mistakes — A Comprehensive Study on Real World Concurrency Bug Characteristics”...
View in text
Excerpt 7
块,它将找到 foo 的条目。一旦找到,文件系统也会找到 下一个需要的 foo 的 inode 号(假定是 44)。 下一步是递归遍历路径名,直到找到所需的 inode。在这个例子中,文件系统读取包含 foo 的 inode 及其目录数据的块,最后找到 bar 的 inode 号。open()的最后一步是将 ba...
View in text
Excerpt 8
,现在它的各个部分现在也分布在整个磁盘上?归根到底:文件系统必须在磁盘上有一 些固定且已知的位置,才能开始文件查很。 LFS 在磁盘上只有这样一个固定的位置,称为检查点区域(checkpoint region,CR)。检 查点区域包含指向最新的 inode 映射片段的指针(即地址),因此可以通过首先读取 CR 来...
View in text
Tags
AI categories
OSProgrammingEducation
Publish Year: 2019
Language: English
Pages: 492
File Format: PDF
File Size: 20.7 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…