Skip to content

A minimal operating system (2K LOC) on QEMU and a RISC-V board

License

Notifications You must be signed in to change notification settings

P-Gu/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 in one semester.

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

This is an image Note: cloc was used to count the lines of code. The command below uses cloc to count LOC of the whole repo, 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                               36            487            593           1580
C/C++ Header                    10             70            105            286
Assembly                         3              6             24             70
make                             1             12              0             64
-------------------------------------------------------------------------------
SUM:                            50            575            722           2000 <- exactly 2000
-------------------------------------------------------------------------------

Earth and Grass Operating System

We use egos-classic and egos-2000 as our teaching OS at Cornell. They both adopt a 3-layer architecture.

  • The earth layer implements hardware-specific abstractions.
    • tty and disk device interfaces
    • interrupt and memory management interfaces
  • The grass layer implements hardware-independent abstractions.
    • processes, system calls and inter-process communications
  • The application layer implements file system, shell and user commands.

The definitions of struct earth and struct grass in egos.h specify the interfaces of these layers.

Usages and Documentation

For compiling and running egos-2000, please read USAGES.md.

The RISC-V instruction set manual introduces the privileged ISA. The SiFive FE310 manual introduces the memory map, especially the GPIO, UART and SPI bus controllers. This document further introduces the teaching plans, architecture and development history of egos-2000.

For any questions, please contact Yunhao Zhang.

Acknowledgements

Many thanks to Robbert van Renesse, Lorenzo Alvisi, Shan Lu and Hakim Weatherspoon for supporting this project. Many thanks to Meta for a Meta fellowship. Many thanks to all CS5411/4411 students at Cornell over the years for helping improve this course.

About

A minimal operating system (2K LOC) on QEMU and a RISC-V board

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • C 94.6%
  • Makefile 3.1%
  • Assembly 2.2%
  • GDB 0.1%