CSE 120 Nachos Project

Summer 2010

  1. Nachos
  2. Projects
  3. Documentation
  4. Distributions
  5. Compiling
  6. Tools
  7. Assistance
  8. Cheating


Nachos is a popular instructional operating system for undergraduate OS classes. It has been used for many years at many universities. It is a challenging system to learn, but is also as rewarding as it is challenging.

Nachos may seem complex (because it is) and confusing at first, but after using the system for a while you will become familiar and comfortable with it. There are also some advantages with using such a well-established project. First, it has been thoroughly debugged and is therefore relatively stable. Second, there is extensive documentation describing the Nachos system. Both of these points should make it easier for you to learn and use Nachos.

There are two versions of Nachos in current use, Nachos 3.4 and Nachos 4.0. They both have the same functionality. Nachos 4.0 is an updated version of 3.4, has been more widely ported, and is perhaps better architected from a software engineering point of view. However, most of the detailed guides describing the Nachos system refer to Nachos 3.4. Because of this reason, we will be using Nachos 3.4.


Tom Anderson originally developed Nachos for a semester-long course at U.C. Berkeley that involved five projects. When he moved to the University of Washington, he adapted the original Nachos project outline to a quarter-long course involving three projects: (1) Threads, (2) Multiprogramming, and (3) Virtual Memory. It is this outline that we will be following for our projects this quarter.


There are many resouces for using and learning the Nachos system. Essential are the original Nachos paper and the Nachos Road Map by Thomas Narten, but you will probably find it useful to browse the other resources as well (such as the Working With Nachos pages at Duke University).


The platform we will officially support is Linux/x86 on the machines in the CSE B230-B270 labs. We have customized the generic Nachos distribution for the CSE 120 class, so you should use the version of Nachos that we make available (i.e., do not download from other sites on the Web). Relative to your CSE 120 home directory, the Nachos distribution file can be accessed via the following path:

Or you can download it from the class Web site:

To copy, unpack, and compile the distribution, do the following in your class account:

% cp ~/../public/cse120su10-nachos.tar.gz .

Note: Compiling Nachos requires some environment variables to be set. When you log in to your class account, if you were prompted to "prep" a class, be sure and select "cs120u". If you were not prompted, you can run prep from the command line:

% prep cs120u
Once you have copied the distribution, do the following:
% tar xvzf cse120su10-nachos.tar.gz
% cd nachos-3.4/code
% gmake
% cd threads
% ./nachos

Note that the "-" at the end of the gunzip/tar command line is separated from the "xvf" by a space (it means "read from stdin"); if you don't have that space, the command will not work properly. After unpacking the distribution, it will create and populate the directory "nachos-3.4".

Using Nachos on other systems

Nachos has been developed to run on almost any operating system, but it requires the installation of a MIPS cross-compiler (so that you can compile C code that you write into MIPS executables independently of the architecture that you run the compiler on). We have installed a MIPS cross-compiler on the uAPE systems for class use, so on the class machines you do not have to worry about it.

You are welcome (and encouraged) to download Nachos to any system that you want. However, we cannot make any guarantees that it will compile on your system, although we can try to help if you run into difficulties. Furthermore, since generating a MIPS cross-compiler can be an involved task, if you do use Nachos on another system you will still probably want to use the cross-compilers that we have used:

The distribution file has been tested on modern x86 and x86-64 Linux systems. You need to edit either code/prepfile.csh or code/prepfile.bash, depending on your shell, and change the CSE120_GCC variable to point to your installed mips cross compiler. Before running make for the first time that session, source this file:

$ . prepfile.bash

If you use your own machine, be sure to compile and test your code on one of the uAPE systems before submitting it!

Nachos Configuration

If you are curious about how to configure Nachos for a particular system, there are three Makefiles that we have changed:

In the Nachos distribution for CSE 120, we have changed the Makefiles to refer to environment variables. These environment variables are set in a prepfile script located in ~/../public/prepfile. One example in csh/tcsh is:


To compile Nachos, cd into the code subdirectory and run gmake. This will compile all files in all subdirectories. Note, however, that each project will be concentrated in one subdirectory at a time (e.g., Project 1 will be done in the threads subdirectory). After you have compiled all subdirectories, you can just run gmake from within one of the subdirectories to recompile the version of nachos created in that directory.


Subversion: Subversion is the default version control system we will use in CSE 120. For an excellent reference manual, refer to the free online book Version Control with Subversion.


The Nachos projects are aggressive, complex, and time-consuming. Nachos may seem overwhelming at first, but the projects are not impossible. If your group is spending many hours stuck on a single problem, then you should seek assistance. Be sure and read the various support documents. Come to office hours.


Cheating is not an acceptable method for completing your projects. The consequences of cheating will correspond to the severity (e.g., failure of the assignment, failure of the course). The academic honesty guidelines outlined by Charles Elkan for CSE 130 apply to this course.

I urge you to resist any temptation to cheat, both on the projects as well as the homeworks and exams, no matter how desperate the situation may seem. If you are in circumstances that you feel compel you to cheat, come to me first before you do so.