Project 0: Jump Start

Fall 2023

Due: Friday, October 6, at 11:59pm

Note: This is an individual assignment. Each student must submit a copy of their session's output.

Nachos is a Java application written to perform the functions of a real operating system. The details of how the operating system implements concepts such as threading, virtual memory, and processes are exposed to you. All of the source code implementing the Nachos operating system is included with the distribution. However, this baseline implementation does not implement some very useful features. During the quarter, your job will be to complete the missing portions of the operating system and use the functionality in your projects.

In this pre-project you will familiarize yourself with installing and compiling the Nachos distribution. The tutorial below should not take that much time; if you seem to be having serious problems, check Piazza to see if others have reported the same problem and post a note if not.


  1. Whether you are working on a desktop in the lab or your laptop, login to ieng6 using an ssh client. Login using your normal student account, and be sure to prep cs120fa23 when you login. (Some students, such as concurrent enrollment students, may have a cs120**** course-specific account, which should automatically prep.) If you run into any issues running any of these commands, or if your enrollment is still pending, see Troubleshooting issues at the bottom of this page.
    % ssh
    % prep cs120fa23

  2. Download the Nachos distribution into your home directory on ieng6, and then unpack it:
    % wget ''
    % tar xvfz nachos-cse120-fa23.tar.gz
    Also take some time to read the instructions for all projects on the main projects page.

  3. After unpacking the Nachos distribution, go into the proj0 directory and compile Nachos for this project:
    % cd nachos/proj0
    % make
    You can safely ignore any compiler warnings. Then run the nachos program:
    % nachos
    The nachos command is a script that invokes the Java VM to run Nachos. It should already be in your path, and you can also find the script in bin/nachos. Running the program causes the methods of nachos.threads.ThreadedKernel to be called in the order listed in threads/

    1. The ThreadedKernel constructor is invoked to create the Nachos kernel.
    2. This kernel is initialized with initialize().
    3. This kernel is tested with selfTest().
    4. This kernel is finally "run" with run(). For now, run() does nothing, since our kernel is not yet able to run user programs.

    Your session should resemble the following (but does not have be exactly the same):

    $ cd nachos/proj0
    $ make
    $ nachos (equivalent to ../bin/nachos)
    nachos 5.0j initializing...
    *** thread 0 looped 0 times
    *** thread 1 looped 0 times
    *** thread 0 looped 1 times
    *** thread 1 looped 1 times
    *** thread 0 looped 2 times
    *** thread 1 looped 2 times
    *** thread 0 looped 3 times
    *** thread 1 looped 3 times
    *** thread 0 looped 4 times
    *** thread 1 looped 4 times
    Machine halting!
    Ticks: total 2130, kernel 2130, user 0
    Disk I/O: reads 0, writes 0
    Console I/O: reads 0, writes 0
    Paging: page faults 0, TLB misses 0
    Swap: COFF reads 0, swap reads 0, swap writes 0, swap skips 0
    Network I/O: received 0, sent 0
  4. Trace the execution path by hand to find where the output is coming from (i.e., which classes are generating those output statements). Your job will be simple for this initial project, simply modifying a print statement. Specifically, change the Nachos output print statement:
    *** thread n looped m times
    *** awesome thread n looped m times
    And that's it. Be sure to test your changes before you submit them.

Code Submission

For this project, each student must submit their project using a script we provide. Go to your top-level nachos directory (not the nachos/proj0/nachos subdirectory) and run the submit-proj0 script:

% cd ..  (assuming still in nachos/proj0 dir, cd up to the nachos/ dir)
% ls
Makefile  ag   machine  proj0  proj2  security  threads   vm
README    bin  network  proj1  proj3  test      userprog
% submit-proj0

The output of submit-proj0 should resemble the following. the output likely will not be exactly the same (e.g., file sizes), and that's ok:

Source file information:
   source file name:   proj0.tar.gz
   source file date:   Sun Oct  1 10:23:51 2023
   source file size:   [...] bytes 
Copying to /home/linux/ieng6/cs120fa23/turnin.dest/account 
Total bytes written: [...]
Please check to be sure that's reasonable.

The "check to be sure that's reasonable" comment just means to verify that the number of bytes copied (bytes written) is the same as the size of your proj0.tar.gz file (source file size). If it is, then everything worked and you have successfully turned in project 0.

% ls -l proj0.tar.gz
-rw-r----- 1 account  [...] Oct  1 10:30 proj0.tar.gz    

You will have until the posted due date to submit this project. You can submit as many times as you like. The last version submitted before the due date will be the one accepted.

Troubleshooting Account Issues

Pending Enrollment

If your enrollment is still pending or if you encounter errors of the form "Module(s) not found: cs120****" (e.g., when invoking prep), then try explicitly running the following command before completing project 0:

%  module load /home/linux/ieng6/cs120fa23/public/modulefiles/cs120fa23

prep not found

If you are logged in to an ieng6 server and you encounter problems running prep (e.g., when you run it from the shell it reports "prep: command not found..."), then it is likely you have modified your .bashrc in such a way that it cannot find prep (e.g., it is no longer in your path). Either change your .bashrc file back to the default, or contact ETS to help fix it.