Xv6, a simple Unix-like teaching operating system

The lastest version of xv6 is at: xv6

Introduction

History and Background

For many years, MIT had no operating systems course. In the fall of 2002, one was created to teach operating systems engineering. In the course lectures, the class worked through Sixth Edition Unix (aka V6) using John Lions's famous commentary. In the lab assignments, students wrote most of an exokernel operating system, eventually named Jos, for the Intel x86. Exposing students to multiple systems–V6 and Jos–helped develop a sense of the spectrum of operating system designs.

V6 presented pedagogic challenges from the start. Students doubted the relevance of an obsolete 30-year-old operating system written in an obsolete programming language (pre-K&R C) running on obsolete hardware (the PDP-11). Students also struggled to learn the low-level details of two different architectures (the PDP-11 and the Intel x86) at the same time. By the summer of 2006, we had decided to replace V6 with a new operating system, xv6, modeled on V6 but written in ANSI C and running on multiprocessor Intel x86 machines. Xv6's use of the x86 makes it more relevant to students' experience than V6 was and unifies the course around a single architecture. 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. 6.828 substituted xv6 for V6 in the fall of 2006.

Xv6 sources and text

git clone git://github.com/mit-pdos/xv6-public.git

git checkout -b xv6-rev7 xv6-rev7

The xv6 source code is licensed under the traditional MIT license; see the LICENSE file in the source distribution. To help students read through xv6 and learn about the main ideas in operating systems we also distribute a textbook/commentary for the latest xv6. The line numbers in this book refer to the above source booklet.

xv6 compiles using the GNU C compiler, targeted at the x86 using ELF binaries. On BSD and Linux systems, you can use the native compilers; On OS X, which doesn't use ELF binaries, you must use a cross-compiler. Xv6 does boot on real hardware, but typically we run it using the QEMU emulator. Both the GCC cross compiler and QEMU can be found on the 6.828 tools page.

Xv6 lecture material

Unix Version 6

6.828's xv6 is inspired by Unix V6 and by:

Lions' Commentary on UNIX' 6th Edition , John Lions, Peer to Peer Communications; ISBN: 1-57398-013-7; 1st edition (June 14, 2000). An on-line version of the Lions commentary, and the source code. The v6 source code is also available online through the PDP Unix Preservation Society.

, John Lions, Peer to Peer Communications; ISBN: 1-57398-013-7; 1st edition (June 14, 2000).

The PDP11/40 Processor Handbook , Digital Equipment Corporation, 1972. A PDF (made from scanned images, and not text-searchable) A web-based version that is indexed by instruction name.

, Digital Equipment Corporation, 1972.

Feedback

Russ Cox (rsc@swtch.com)

Frans Kaashoek (kaashoek@mit.edu)

Robert Morris (rtm@mit.edu)

You can reach all of us at 6.828-staff@pdos.csail.mit.edu.