Xv6, a simple Unix-like teaching operating system

a minimal Unix-like kernel for RISC-V

 GitHub Reference

About

From the README,

xv6 is a re-implementation of Dennis Ritchie’s and Ken Thompson’s Unix Version 6 (v6). xv6 loosely follows the structure and style of v6, but is implemented for a modern RISC-V multiprocessor using ANSI C.

This is an undergraduate course at MIT that has students implement a minimal Unix-like kernel with the following assignments (ref the course schedule)

  1. util: Unix utilities
  2. syscall: System calls
  3. pgtbl: Page tables
  4. traps: Traps
  5. cow: Copy-on-write fork
  6. thread: Multithreading
  7. net: Network driver
  8. lock: Parallelism/locking
  9. fs: File system
  10. mmap: Mmap

Personal Notes

This was a meaningful continuation of the eXpOS project that I implemented in college. That had a lot of the core concepts as the above, but the implementation was for a simulated multi-processor architecture (XSM) that abstracts a lot of the complexities of real-world machines. It was fun to work on something that could genuinely run on a real-world machine. Over the course of implementing this, I had to refer the official RISC-V ISA manual to understand some implementation details, which was also pretty cool.

I paused my implementation somewhere in the middle of Assignment 7 above, mostly because some personal stuff came up and I got lost reading the E1000 Software Developer’s Manual. This is definitely something I plan to pick up and finish again, possibly once I get my hands on the Framework RISC-V Mainboard and can boot into my own OS!