2008-09-03 06:50:04 +02:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Xv6, a simple Unix-like teaching operating system</title>
|
|
|
|
<style type="text/css"><!--
|
|
|
|
body {
|
|
|
|
background-color: white;
|
|
|
|
color: black;
|
|
|
|
font-size: medium;
|
|
|
|
line-height: 1.2em;
|
|
|
|
margin-left: 0.5in;
|
|
|
|
margin-right: 0.5in;
|
|
|
|
margin-top: 0;
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
text-indent: 0in;
|
|
|
|
text-align: left;
|
|
|
|
margin-top: 2em;
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1.4em;
|
|
|
|
}
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
text-indent: 0in;
|
|
|
|
text-align: left;
|
|
|
|
margin-top: 2em;
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1.2em;
|
|
|
|
}
|
|
|
|
--></style>
|
|
|
|
</head>
|
|
|
|
<body bgcolor=#ffffff>
|
2011-02-19 16:36:14 +01:00
|
|
|
|
2008-09-03 06:50:04 +02:00
|
|
|
<h1>Xv6, a simple Unix-like teaching operating system</h1>
|
2011-02-19 16:36:14 +01:00
|
|
|
|
|
|
|
<h2>Introduction</h2>
|
|
|
|
|
|
|
|
Xv6 is a teaching operating system developed in the summer of 2006 for
|
|
|
|
MIT's operating systems
|
|
|
|
course, <a href="http://pdos.csail.mit.edu/6.828">6.828: operating
|
|
|
|
systems Engineering</a>. We hope that xv6 will be useful in other
|
|
|
|
courses too. This page collects resources to aid the use of xv6 in
|
|
|
|
other courses, including a commentary on the source code itself.
|
|
|
|
|
2008-09-03 06:50:04 +02:00
|
|
|
<h2>History and Background</h2>
|
2011-02-19 16:36:14 +01:00
|
|
|
|
2011-09-06 02:54:25 +02:00
|
|
|
<p>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 <a href="#v6">Sixth Edition Unix (aka V6)</a> 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.
|
2011-02-19 16:36:14 +01:00
|
|
|
|
|
|
|
<p>
|
2008-09-03 06:50:04 +02:00
|
|
|
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.
|
2008-09-03 14:29:44 +02:00
|
|
|
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.
|
2008-09-03 06:50:04 +02:00
|
|
|
Finally, writing a new system allowed us to write cleaner versions
|
|
|
|
of the rougher parts of V6, like the scheduler and file system.
|
2011-09-06 02:54:25 +02:00
|
|
|
6.828 substituted xv6 for V6 in the fall of 2006.
|
2008-09-03 06:50:04 +02:00
|
|
|
|
|
|
|
<h2>Xv6 sources</h2>
|
2011-02-19 16:36:14 +01:00
|
|
|
|
2011-09-06 02:54:25 +02:00
|
|
|
The latest xv6 is <a href="xv6-rev5.tar.gz">xv6-rev5.tar.gz</a>. We distribute
|
|
|
|
the sources in electronic form but also as a printed booklet with line numbers
|
|
|
|
that keep everyone together during lectures. The booklet is available as <a
|
|
|
|
href="xv6-rev5.pdf">xv6-rev5.pdf</a>. The xv6 source code is licensed under
|
|
|
|
the traditional <a href="http://www.opensource.org/licenses/mit-license.php">MIT
|
|
|
|
license</a>; 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 <a href="book-rev6.pdf">textbook/commentary</a> for the latest xv6.
|
2011-02-19 16:36:14 +01:00
|
|
|
|
|
|
|
<p>
|
2008-09-03 06:50:04 +02:00
|
|
|
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 Bochs emulator.
|
|
|
|
Both the GCC cross compiler and Bochs
|
2011-02-19 16:36:14 +01:00
|
|
|
can be found on the <a href="../2010/tools.html">6.828 tools page</a>.
|
|
|
|
|
|
|
|
<h2>Xv6 lecture material</h2>
|
|
|
|
|
2011-09-06 02:54:25 +02:00
|
|
|
In 6.828, the lectures in the first half of the course cover the xv6 sources and
|
|
|
|
text. The lectures in the second half consider advanced topics using research
|
|
|
|
papers; for some, xv6 serves as a useful base for making discussions concrete.
|
|
|
|
The lecture notes are available from the 6.828 schedule page.
|
2011-02-19 16:36:14 +01:00
|
|
|
|
|
|
|
<a name="v6"></a>
|
|
|
|
<h2>Unix Version 6</h2>
|
|
|
|
|
|
|
|
<p>6.828's xv6 is inspired by Unix V6 and by:
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
<li>Lions' <i>Commentary on UNIX' 6th Edition</i>, John Lions, Peer to
|
|
|
|
Peer Communications; ISBN: 1-57398-013-7; 1st edition (June 14, 2000).
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
<li>An on-line version of the <a
|
|
|
|
href="http://www.lemis.com/grog/Documentation/Lions/">Lions
|
|
|
|
commentary</a>, and <a href="http://v6.cuzuco.com/">the source code</a>.
|
|
|
|
|
|
|
|
|
|
|
|
<li>The v6 source code is also available <a
|
|
|
|
href="http://minnie.tuhs.org/UnixTree/V6/usr/sys/">online</a>
|
|
|
|
through <a
|
|
|
|
href="http://minnie.tuhs.org/PUPS/">the PDP Unix Preservation
|
|
|
|
Society</a>.
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
The following are useful to read the original code:
|
|
|
|
<ul>
|
|
|
|
<li><i>
|
|
|
|
The PDP11/40 Processor Handbook</i>, Digital Equipment Corporation, 1972.
|
|
|
|
<ul>
|
|
|
|
<li>A <a href="http://pdos.csail.mit.edu/6.828/2005/readings/pdp11-40.pdf">PDF</a> (made from scanned images,
|
|
|
|
and not text-searchable)
|
|
|
|
<li>A <a href="http://pdos.csail.mit.edu/6.828/2005/pdp11/">web-based
|
|
|
|
version</a> that is indexed by instruction name.
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</ul>
|
2008-09-03 06:50:04 +02:00
|
|
|
|
|
|
|
<h2>Feedback</h2>
|
|
|
|
If you are interested in using xv6 or have used xv6 in a course,
|
|
|
|
we would love to hear from you.
|
|
|
|
If there's anything that we can do to make xv6 easier
|
|
|
|
to adopt, we'd like to hear about it.
|
|
|
|
We'd also be interested to hear what worked well and what didn't.
|
2011-02-19 16:36:14 +01:00
|
|
|
<p>
|
2008-09-03 06:50:04 +02:00
|
|
|
Russ Cox (rsc@swtch.com)<br>
|
|
|
|
Frans Kaashoek (kaashoek@mit.edu)<br>
|
|
|
|
Robert Morris (rtm@mit.edu)
|
2011-02-19 16:36:14 +01:00
|
|
|
<p>
|
2008-09-03 06:50:04 +02:00
|
|
|
You can reach all of us at 6.828-staff@pdos.csail.mit.edu.
|
2011-02-19 16:36:14 +01:00
|
|
|
|