@bkdgiffug: 操作系统底层原理向来是计算机领域的硬骨头。几十万行内核源码摊在眼前,翻上几页便头晕目眩,既抓不住设计主线,更谈不上通篇精读。 egos-2000这个教学项目,只用2000行代码,就把操作系统的核心组件完整呈现了出来。 这套系统的三层架构尤…

X AI KOLs Timeline 工具

摘要

egos-2000是一个教学操作系统项目,仅用2000行代码实现操作系统核心组件,三层架构清晰,支持RISC-V平台,配套教材提供9个课程项目,便于学习和实践。

操作系统底层原理向来是计算机领域的硬骨头。几十万行内核源码摊在眼前,翻上几页便头晕目眩,既抓不住设计主线,更谈不上通篇精读。 egos-2000这个教学项目,只用2000行代码,就把操作系统的核心组件完整呈现了出来。 这套系统的三层架构尤其清晰: 底层直接管控硬件交互 中间层处理进程调度与系统调用 上层实现文件系统和命令解释器 它还能跑在QEMU模拟器和真实RISC-V开发板上,官方配套教材直接给出9个课程项目,方便边学边练。 操作系统从加电到用户界面究竟如何运转?这份源码就是最好的解剖样本,值得静下心一行一行啃透。 https://github.com/yhzhang0128/egos-2000…
查看原文
查看缓存全文

缓存时间: 2026/08/20 08:54

操作系统底层原理向来是计算机领域的硬骨头。几十万行内核源码摊在眼前,翻上几页便头晕目眩,既抓不住设计主线,更谈不上通篇精读。

egos-2000这个教学项目,只用2000行代码,就把操作系统的核心组件完整呈现了出来。

这套系统的三层架构尤其清晰: 底层直接管控硬件交互 中间层处理进程调度与系统调用 上层实现文件系统和命令解释器 它还能跑在QEMU模拟器和真实RISC-V开发板上,官方配套教材直接给出9个课程项目,方便边学边练。

操作系统从加电到用户界面究竟如何运转?这份源码就是最好的解剖样本,值得静下心一行一行啃透。 https://github.com/yhzhang0128/egos-2000…


yhzhang0128/egos-2000

Source: https://github.com/yhzhang0128/egos-2000

Vision

This project’s vision is to help every student read all the code of a teaching operating system.

With only 2000 lines of code, egos-2000 implements every component of a teaching operating system that runs on both QEMU and RISC-V boards. The EGOS book contains 9 course projects based on egos-2000.

Fail to load an image of egos-2000.

# The cloc utility is used to count the lines of code.
> cloc egos-2000 --exclude-ext=md
...
github.com/AlDanial/cloc v 1.94  T=0.05 s (949.3 files/s, 62349.4 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               30            453            677           1592
C/C++ Header                     9             64            105            258
Assembly                         3             14             46             92
make                             1             17             10             58
-------------------------------------------------------------------------------
SUM:                            43            548            838           2000 (exactly!)
-------------------------------------------------------------------------------

Earth and Grass Operating System

The “egos” part of egos-2000 is named after its three-layer architecture.

  • The earth layer implements hardware-specific abstractions.
    • tty and disk device interface
    • timer and memory management interface
  • The grass layer implements hardware-independent abstractions.
    • process control block and system call interface
  • The application layer implements file system, shell, and user commands.

The definitions of struct earth and struct grass in the header file egos.h specify the layer interface. Please read USAGES.md for running egos-2000, and the instruction set manuals for the RISC-V privileged ISA.

Acknowledgements

Many thanks to Meta for a Facebook fellowship. Many thanks to Robbert van Renesse, Lorenzo Alvisi, Shan Lu, Hakim Weatherspoon and Christopher Batten for their support. Many thanks to Cheng Tan and Yu-Ju Huang for providing valuable feedback on the EGOS book and using egos-2000 in Northeastern CS4973/6640 and Cornell CS4411/5411. Many thanks to Haobin Ni and Hongbo Zhang for porting egos-2000 to mriscv, a simple processor written in SystemVerilog. Many thanks to Brandon Fusi for porting egos-2000 to Allwinner D1 and Sipeed’s Lichee RV64 Nezha compute module. Many thanks to Zack Light for making a YouTube video introducing egos-2000, and many thanks to Christopher Allison for making the DOOM video game work on egos-2000.

For any questions, please contact Yunhao Zhang.

相似文章

@XAMTO_AI: 自学编程这事儿,谁起步时没被现实按在地上摩擦过几轮? 有个北大本科生,大一就扎进计算机里自己折腾,四年熬下来,那些绊过他的、让他差点放弃的,反倒成了最值钱的经验——他把所有真正起过作用的学习资料和课程,按实战顺序理成了一份开源文档。 底层…

X AI KOLs Timeline

北大本科生将自学计算机四年积累的高质量开源课程资源(来自MIT、斯坦福、伯克利等)按实战顺序整理成一份开源文档,旨在帮助零基础者系统学习编程。

@XAMTO_AI: 兄弟们,搞架构的别再死磕那些八股文了! 这老哥整了个开源仓库,专治架构焦虑,一行代码都不用写,全是硬核架构图。 划重点: 25个真实系统模板,电商、信息流、支付全都有 AI方向也没落下,RAG、AI Agent、AI网关全给你扒清楚了 连…

X AI KOLs Timeline

介绍一个开源架构知识库 awesome-architecture,包含 25 个真实系统模板(电商、信息流、支付、AI 方向如 RAG、Agent 等)和配套教程,帮助开发者从代码执行转向架构思维。