[UPDATE] Update CS162 Course (#841)

* update CS162

* update CS162
This commit is contained in:
David Xia
2026-02-21 11:14:46 +08:00
committed by GitHub
parent 9519b3a667
commit 4739f68318
3 changed files with 57 additions and 17 deletions

View File

@@ -3,30 +3,49 @@
## Descriptions
- Offered by: UC Berkeley
- Prerequisites: CS61A, CS61B, CS61C
- Prerequisites: CS61A, CS61B, CS61C; Solid C programming and GDB debugging skills
- Programming Languages: C, x86 Assembly
- Difficulty: 🌟🌟🌟🌟🌟🌟
- Class Hour: 200 hours+
The course impressed me in two aspects:
Firstly, the textbook: *Operating Systems: Principles and Practice (2nd Edition)* is written in an insightful but easy-to-understand way, well compensated for the lack of theoretical knowledge in MIT6.S081, I highly recommend you to read this book.
Firstly, the textbook: Operating Systems: Principles and Practice (2nd Edition) consists of four volumes. It is written in a very accessible yet profound way, with vivid and sometimes even humorous language. It serves as an excellent supplement to the lecture videos and perfectly fills some theoretical gaps left by MIT 6.S081. This is also the experimental textbook for CMU's OS course (15410), I highly recommend reading it! Related resources are shared in the "Classic Books" section of this repository.
Secondly, the project for this course *Pintos* is a great journey for system hackers. *Pintos* is a toy operating system developed at Stanford for educational use. The author Ben Pfaff even published a [paper](https://benpfaff.org/papers/pintos.pdf) to explain the design principles of *Pintos*.
Unlike the small but comprehensive design philosophy in MIT's xv6 labs, *Pintos* emphasizes system design and implementation more. The codebase is about 10,000 LOC and only provides the basic functions of a working operating system. The four projects let you add scheduler (Project1), system calls (Project2), virtual memory (Project3), and the file system (Project4) to this extremely simple operating system. All projects leave a a big design space for students and require more than 2000 LOC. Based on the [feedback](https://www.quora.com/What-is-it-like-to-take-CS-140-Operating-Systems-at-Stanford) from Stanford students, the latter two projects take over 40 hours per person even in teams of 3-4 people.
Unlike the small but comprehensive design philosophy in MIT's xv6 labs, *Pintos* emphasizes system design and implementation more. The codebase is about 10,000 LOC and only provides the basic functions of a working operating system. Each project has almost no boilerplate code; you must design the implementation yourself and weigh the pros and cons of different schemes. The four projects let you add scheduler (Project1), system calls (Project2), virtual memory (Project3), and the file system (Project4) *(Note: The specific requirements for CS162 Pintos differ slightly; see the assignment description below)* to this extremely simple operating system. All projects leave a a big design space for students and require more than 2000 LOC. Based on the [feedback](https://www.quora.com/What-is-it-like-to-take-CS-140-Operating-Systems-at-Stanford) from Stanford students, the latter two projects take over 40 hours per person even in teams of 3-4 people.
Although it is tough, Stanford, Berkeley, JHU and many other top U.S. colleges have chosen *Pintos* as their OS course project. If you're really interested in operating systems, it will greatly improve your ability to write and debug low-level system code. For me, it is an invaluable experience to design, implement, and debug a large system independently.
Although it is tough, Stanford, Berkeley, JHU and many other top U.S. colleges have chosen *Pintos* as their OS course project. If you're really interested in operating systems, it will greatly improve your ability to write and debug low-level system code and teach you how to design a system by making trade-offs between different possibilities. For me, it is an invaluable experience to design, implement, and debug a large system independently.
*Pintos* will also be introduced as a course project in Peking University's OS Course. In the Spring 2022 semester, I worked with [another TA](https://github.com/AlfredThiel) to write a comprehensive [lab documentation](https://pkuflyingpig.gitbook.io/pintos) and provided a docker image for the ease of cross-platform development. In the last semester before graduation, I hope such an attempt can make more people fall in love with systems and contribute to the field of systems in China.
## Course Resources
- Course Website: <https://cs162.org/>
- Lecture Videos: <https://www.youtube.com/watch?v=YfHY0pvpRkk>, videos for each lecture can be found on the course website.
- Textbook: [Operating Systems: Principles and Practice (2nd Edition)](http://ospp.cs.washington.edu/)
- Assignments: <https://cs162.org/>, 6 Homework, 3 Projects, the course website has specific requirements.
- Course Website:
- [Current Semester](https://cs162.org/)
- [Fa25 - Wayback Machine](https://web.archive.org/web/20251211080516/https://cs162.org/)
- Lecture Videos: Currently, three semesters are publicly available: Fall 2020, Fall 2021, and Spring 2022. Based on my experience with the Fall 2025 semester, the **Spring 2022** version is best for self-study. It was recorded in-person (except for the first four lectures), featuring more student-teacher interaction and many valuable questions addressed in class:
- [Spring 2022 Lecture Videos (Bilibili)](https://www.bilibili.com/video/BV1L541117gr?vd_source=e293470ea109e008c4d9516e39ef318f&p=5&spm_id_from=333.788.videopod.episodes)
- [Fall 2020 Lecture Videos (Bilibili)](https://www.bilibili.com/video/BV1MwDSYWEKy?spm_id_from=333.788.videopod.sections&vd_source=e293470ea109e008c4d9516e39ef318f&p=24)
- Fall 2021 video links can be found on the [Fall 2021 Website](https://web.archive.org/web/20211216005317/https://cs162.org/).
- Textbook: [Operating Systems: Principles and Practice (2nd Edition)](http://ospp.cs.washington.edu/). This textbook is an excellent supplement to the lectures and is highly recommended.
- Assignments: Consists of 3 Projects and 6 Homeworks. (The workload for each Homework is roughly equivalent to a full Project in most other open-source courses. Projects were originally designed for teams; self-studying them alone involves a significant workload):
- 3 Projects (each with complete local tests):
1. User Programs: Implement argument parsing for process execution, process-related system calls (including the `fork` syscall added in 2025), and file-related system calls.
2. Threads: Implement a non-busy-waiting `timer_sleep` function, a strict priority scheduler, multi-threading support, and a simplified `pthread` library. (Note: This differs from the Multi-Level Feedback Queue requirements in the PKU Pintos and Stanford CS212 versions).
3. File Systems: Implement a kernel Buffer Cache, extensible files, and subdirectories.
- 6 Homeworks: Includes a sub-task for the MapReduce assignment. Both HTTP and MapReduce assignments have two versions: C and Rust. Except for the Memory lab, most Homeworks lack local autograders (though most can be manually tested effectively, except for MapReduce, which can be replaced by the [MIT 6.824 MapReduce lab](https://pdos.csail.mit.edu/6.824/labs/lab-mr.html)).
1. List: Familiarize with the built-in linked list structure in Pintos.
2. Shell: Implement a Shell supporting directory commands, program execution, path parsing, redirection, pipes, and signal handling.
3. HTTP: Implement an HTTP server supporting GET requests.
4. Memory: Implement memory management functions like `sbrk` and `malloc`.
5. MapReduce: Implement a fault-tolerant MapReduce system (including the RPC Lab).
---
## Personal Resources
All resources and assignment implementations (including code, design documents, and starter code) used during my study of the **Fall 2025** semester are summarized in the [@RisingUppercut/CS162-fall25 - GitHub](https://github.com/RisingUppercut/UCB_CS162_2025Fall) repository.
Since the Operating System Course at PKU uses the project, my implementation is not open source to prevent plagiarism.

View File

@@ -3,32 +3,53 @@
## 课程简介
- 所属大学UC Berkeley
- 先修要求CS61A, CS61B, CS61C
- 先修要求CS61A, CS61B, CS61C扎实的C语言能力及GDB调试能力
- 编程语言C, x86汇编
- 课程难度:🌟🌟🌟🌟🌟🌟
- 预计学时200 小时+,上不封顶
这门课让我记忆犹新的有两个部分:
首先是教材,这本书用的教材 *Operating Systems: Principles and Practice (2nd Edition)* 一共四卷,写得非常深入浅出,很好地弥补了 MIT6.S081 在理论知识上的些许空白,非常建议大家阅读相关资源会分享在本书的经典书籍推荐模块。
首先是教材,这本书用的教材 *Operating Systems: Principles and Practice (2nd Edition)* 一共四卷,写得非常深入浅出,语言生动甚至时而幽默,是本课程 Lecture 视频内容极好的完善与补充,同时也很好地弥补了 MIT6.S081 在理论知识上的些许空白,是 CMU 操作系统课 15410 的实验性教材,非常建议大家阅读相关资源会分享在本书的经典书籍推荐模块。
其次是这门课的 Project —— Pintos。Pintos 是由 Ben Pfaff 等人在 x86 平台上编写的教学用操作系统Ben Pfaff 甚至专门发了篇 [paper](https://benpfaff.org/papers/pintos.pdf) 来阐述 Pintos 的设计思想。
和 MIT 的 xv6 小而精的 lab 设计理念不同Pintos 更注重系统的 Design and Implementation。Pintos 本身仅一万行左右,只提供了操作系统最基本的功能。而 4 个Project就是让你在这个极为精简的操作系统之上分别为其增加线程调度机制 (Project1),系统调用 (Project2),虚拟内存 (Project3) 以及文件系统 (Project4)。所有的 Project 都给学生留有很大的设计空间,总代码量在 2000 行左右。根据 Stanford 学生[自己的反馈][quora_link],在 3-4 人组队的情况下,后两个 Project 的人均耗时也在 40 个小时以上。
和 MIT 的 xv6 小而精的 lab 设计理念不同Pintos 更注重系统的 Design and Implementation。Pintos 本身仅一万行左右,只提供了操作系统最基本的功能。每个project几乎没有框架代码都需要自己设计实现并权衡不同方案的优缺点。而 4 个Project就是让你在这个极为精简的操作系统之上分别为其增加线程调度机制 (Project1),系统调用 (Project2),虚拟内存 (Project3) 以及文件系统 (Project4)*CS162 Pintos 的 project 和上述略有不同,详见下方课程作业说明)*。所有的 Project 都给学生留有很大的设计空间,总代码量在 2000 行左右。根据 Stanford 学生[自己的反馈][quora_link],在 3-4 人组队的情况下,后两个 Project 的人均耗时也在 40 个小时以上。
[quora_link]: https://www.quora.com/What-is-it-like-to-take-CS-140-Operating-Systems-at-Stanford
虽然难度很大,但 Stanford, Berkeley, JHU 等多所美国顶尖名校的操统课程均采用了 Pintos。如果你真的对操作系统很感兴趣Pintos 会极大地提高你编写和 debug 底层系统代码的能力。在本科阶段,能自己设计、实现并 debug 一个大型系统,是一段非常珍贵的经历。
虽然难度很大,但 Stanford, Berkeley, JHU 等多所美国顶尖名校的操统课程均采用了 Pintos。如果你真的对操作系统很感兴趣Pintos 会极大地提高你编写和 debug 底层系统代码的能力,并让你学会设计一个系统,使你在不同可能的设计中学会取舍。在本科阶段,能自己设计、实现并 debug 一个大型系统,是一段非常珍贵的经历。
北大 2022 年春季学期的操作系统实验班也将会首次引入 Pintos 作为课程 Project。我和该课程的[另一位助教](https://github.com/AlfredThiel)整理并完善了 Pintos 的[实验文档](https://pkuflyingpig.gitbook.io/pintos),并利用 Docker 配置了跨平台的实验环境,想自学的同学可以按文档自行学习。在毕业前的最后一个学期,希望能用这样的尝试,让更多人爱上系统领域,为国内的系统研究添砖加瓦。
## 课程资源
- 课程网站:<https://cs162.org/>
- 课程视频:<https://www.youtube.com/watch?v=YfHY0pvpRkk>,每节课的链接参见课程网站
- 课程教材:[Operating Systems: Principles and Practice (2nd Edition)](http://ospp.cs.washington.edu/)
- 课程作业:<https://cs162.org/>6 个 Homework, 3 个 Project具体要求参见课程网站
- 课程网站:
- [当前最新学期](https://cs162.org/)
- [Fa25-WayBack Machine](https://web.archive.org/web/20251211080516/https://cs162.org/)
- 课程视频,目前公开的视频有三个学期,分别为: 2020Fall2021Fall 及 2022Spring 。根据我学习 2025Fall 学期的经历来看2022Spring 的最适合自学,因为这个学期是线下录制的形式(除了前四节),上课时师生之间的互动更多,有很多有价值的问题在课堂上被解决:
- [2022Spring课程视频](https://www.bilibili.com/video/BV1L541117gr?vd_source=e293470ea109e008c4d9516e39ef318f&p=5&spm_id_from=333.788.videopod.episodes)
- [2020Fall课程视频](https://www.bilibili.com/video/BV1MwDSYWEKy?spm_id_from=333.788.videopod.sections&vd_source=e293470ea109e008c4d9516e39ef318f&p=24)
- 2021Fall的各个视频链接在[2021Fall网站](https://web.archive.org/web/20211216005317/https://cs162.org/)上
- 课程教材:[Operating Systems: Principles and Practice (2nd Edition)](http://ospp.cs.washington.edu/),本教材是课上 Lecture 内容的很好的补充,强烈推荐阅读。
- 课程作业3 个 Project6 个 Homework每个Homework的工作量大致相当于其他大部分公开课的Project Project原本要求是组队实现一个人自学的工作量较大
- 3 个 Project , 每个 Project 都有完整的本地测试:
1. User Programs: 实现进程执行函数的参数解析传递实现进程相关的系统调用25年的新增了fork系统调用实现文件相关系统调用。
2. Threads: 实现不忙等的 `timer_sleep` 函数, 实现严格优先级调度器,实现对多线程的支持,实现简化版的 pthread 库(这与北大的 Pintos 及 斯坦福的 CS212 的多级反馈调度的要求不同)。
3. File Systems: 实现文件系统内核缓冲区 Buffer Cache实现可扩容的文件实现子目录。
- 6 个 Homework 其中一个为 Map Reduce 作业的子任务,作业 HTTP 及 Map Reduce 均有两个版本C 和 Rust。除了 Memory 作业外,其他 Homework 均没有本地测试(但除了 Map Reduce 作业外, 其他作业都可以手动测试的大差不差, Map Reduce 作业可换成 [MIT 6.824 的对应作业](https://pdos.csail.mit.edu/6.824/labs/lab-mr.html)
1. List: 熟悉 Pintos 内置的链表结构
2. Shell: 实现支持目录命令、启动程序、路径解析、重定向、管道、信号处理的 Shell
3. HTTP: 实现一个支持 HTTP GET 请求的 HTTP 服务器
4. Memory: 实现 sbrkmalloc 等内存管理函数
5. Map Reduce: 实现一个可容忍错误的 MapReduce 系统
- 包含作业 RPC Lab
## 资源汇总
@[RisingUppercut] 在学习这门课2025Fall中用到的所有资源和作业实现包括代码、设计文档、初始框架代码等都汇总在 [@RisingUppercut/CS162-fall25 - GitHub](https://github.com/RisingUppercut/UCB_CS162_2025Fall) 中。
[RisingUppercut]: https://github.com/RisingUppercut
由于北大的操统实验班采用了该课程的 Project为了防止代码抄袭我的代码实现没有开源。

View File

@@ -213,7 +213,7 @@ nav:
- "ETHz: Computer Architecture": "体系结构/CA.md"
- 操作系统:
- "MIT 6.S081: Operating System Engineering": "操作系统/MIT6.S081.md"
- "UCB CS162: Operating System": "操作系统/CS162.md"
- "UCB CS162: Operating Systems and Systems Programming": "操作系统/CS162.md"
- "NJU OS: Operating System Design and Implementation": "操作系统/NJUOS.md"
- "HIT OS: Operating System": "操作系统/HITOS.md"
- 并行与分布式系统: