Xv6: A Simple Unix-like Teaching Operating System

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.

39 Comments

  1. 2011-11-09 10:34 pm
  2. 2011-11-09 11:34 pm
    • 2011-11-10 10:35 pm
      • 2011-11-11 4:04 am
        • 2011-11-11 12:48 pm
          • 2011-11-12 12:08 am
          • 2011-11-12 1:27 am
          • 2011-11-12 4:59 am
          • 2011-11-12 2:09 pm
          • 2011-11-13 9:03 am
      • 2011-11-11 10:07 am
        • 2011-11-11 10:51 am
          • 2011-11-11 11:38 am
        • 2011-11-11 11:42 pm
      • 2011-11-11 11:32 am
        • 2011-11-11 4:40 pm
          • 2011-11-11 5:12 pm
          • 2011-11-11 7:18 pm
          • 2011-11-11 5:39 pm
          • 2011-11-11 7:17 pm
          • 2011-11-11 9:39 pm
          • 2011-11-12 4:35 pm
          • 2011-11-12 5:00 pm
          • 2011-11-12 5:31 pm
          • 2011-11-12 7:00 pm
          • 2011-11-13 9:26 am
          • 2011-11-13 2:14 pm
          • 2011-11-13 11:47 pm
          • 2011-11-14 9:39 am
          • 2011-11-14 10:27 am
          • 2011-11-14 5:47 pm
          • 2011-11-14 9:52 pm
  3. 2011-11-10 9:29 am
  4. 2011-11-10 12:32 pm
  5. 2011-11-10 7:04 pm
    • 2011-11-12 5:02 pm
  6. 2011-11-10 10:33 pm
    • 2011-11-11 10:24 am
      • 2011-11-11 12:52 pm