Skip to content

A teaching operating system (2K LOC) on QEMU and RISC-V boards

License

Notifications You must be signed in to change notification settings

janpaulpl/egos-2000

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vision

This project's vision is to help every college student read all the code of an operating system.

With only 2000 lines of code, egos-2000 implements every component of an operating system for education. It can run on RISC-V boards and the QEMU software emulator.

Fail to load an image of egos-2000.

# The cloc utility is used to count the lines of code (LOC).
# The command below counts the LOC of everything excluding text documents.
> cloc egos-2000 --exclude-ext=md,txt
...
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                               37            508            657           1577
C/C++ Header                    10             69            105            283
Assembly                         3             10             27             76
make                             1             14              3             64
-------------------------------------------------------------------------------
SUM:                            51            601            792           2000 (exactly 2000!)
-------------------------------------------------------------------------------

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 interfaces
    • timer, exception and memory management interfaces
  • The grass layer implements hardware-independent abstractions.
    • process control block and system call interfaces
  • The application layer implements file system, shell and user commands.

The definitions of struct earth and struct grass in this header file specify the layer interfaces.

Developed for CS4411 at Cornell, egos-2000 also has a special version running on the Verilog processor from ECE4750 at Cornell. The goal is to make OS education more connected with computer architecture.

Usages and Documentation

For compiling and running egos-2000, please read this document. The RISC-V instruction set manual and SiFive FE310 processor manual introduce the privileged ISA and memory map. This document introduces the teaching plans, software architecture and development history.

For any questions, please contact Yunhao Zhang.

Acknowledgements

Many thanks to Meta for a Meta fellowship. Many thanks to Robbert van Renesse, Lorenzo Alvisi, Shan Lu, Hakim Weatherspoon and Christopher Batten for their support. Many thanks to all the CS5411/4411 students at Cornell over the years for helping improve this course. Many thanks to Cheng Tan for providing valuable feedback and using egos-2000 in his CS6640 at Northeastern. Many thanks to Brandon Fusi for porting egos-2000 to the Allwinner's D1 chip using Sipeed's Lichee RV64 compute module.

About

A teaching operating system (2K LOC) on QEMU and RISC-V boards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • C 94.0%
  • Makefile 3.5%
  • Assembly 2.5%