Way back in 2002, MIT decided it needed to start teaching a course in operating system engineering. As part of this course, students would write an exokernel on x86, using Sixth Edition Unix (V6) and John Lions’ commentary as course material. This, however, posed problems.
The biggest problem is that while the course focuses on teaching writing an exokernel for the x86 architecture, Sixth Edition Unix and Lions’ commentary focusses on the PDP-11 – a completely different kind of system. Students complained about these differences, but also the lack of relevance of learning how to code for the PDP-11. On top of that, Sixth Edition Unix is written in a dead dialect of C (pre-K&R C).
So, MIT took a drastic approach: they decided to rewrite Sixth Version Unix for x86 in ANSI C. Along the way, they improved it as well by adding SMP support. “Xv6’s use of the x86 makes it more relevant to students’ experience than V6 was and unifies the course around a single architecture,” the project page details, “Adding multiprocessor support requires handling concurrency head on with locks and threads (instead of using special-case solutions for uniprocessors such as enabling/disabling interrupts) and helps relevance. Finally, writing a new system allowed us to write cleaner versions of the rougher parts of V6, like the scheduler and file system.”
While this project was released in 2006, I had never heard of it (until yesterday), and I’m pretty sure many of you haven’t either. John Lions’ commentary and V6 are of course incredibly famous, but I’m not sure if the same applies to Xv6.
In any case, the code is out there for all to see and use (
git clone git://pdos.csail.mit.edu/xv6/xv6.git), under a MIT license. It typically doesn’t run on real hardware; in fact, MIT runs it in QEMU.