Fall 2024
Due: Friday, October 4, at 11:59pm
Note: This is an individual assignment. Eachstudent must submit a copy of their session's output.
Nachos is a Java application written to perform the functions of areal operating system. The details of how the operating systemimplements concepts such as threading, virtual memory, and processesare exposed to you. All of the source code implementing the Nachosoperating system is included with the distribution. However, thisbaseline implementation does not implement some very useful features.During the quarter, your job will be to complete the missing portionsof the operating system and use the functionality in your projects.
In this pre-project you will familiarize yourself withcompiling and running Nachos. The tutorial below should not take thatmuch time; if you seem to be having serious problems, check Piazza tosee if others have reported the same problem and post a note if not.
Every student will do project 0 individually. When we start project1, you will be working in groups and we will provide each group with agithub repo initialized with a fresh nachos source distribution. As aresult, you can discard the nachos source you used for project 0 oncewe start project 1. It also means that you can experiment with theproject 0 source however you like — no changes you make to thesource in project 0 will propage to the later projects.
Tasks
- Whether you are working on a desktop in the lab or your laptop, login to ieng6 using an ssh client. Login using your normal UCSD student account, and be sure to prep cs120fa24 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 account@ieng6.ucsd.edu$ prep cs120fa24
- Download the Nachos distribution into your home directory on ieng6, and then unpack it:
Also take some time to read the instructions for all projects onthe main projects page.$ wget 'https://cseweb.ucsd.edu/classes/fa24/cse120-a/projects/nachos-cse120-fa24.tar.gz'$ tar xvfz nachos-cse120-fa24.tar.gz
- After unpacking the Nachos distribution, go into the proj0directory and compile Nachos for this project:
You can safely ignore any compiler warnings. Then run the nachos program:$ cd nachos/proj0$ make
The nachos command is a script that invokes the Java VM torun Nachos. It should already be in your path, and you can also findthe script in bin/nachos. Running the program causes themethods of nachos.threads.ThreadedKernel to be called in theorder listed in threads/ThreadedKernel.java:$ nachos
- The ThreadedKernel constructor is invoked to create the Nachos kernel.
- This kernel is initialized with initialize().
- This kernel is tested with selfTest().
- 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... config interrupt timer user-check grader*** 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 timesMachine halting!Ticks: total 2130, kernel 2130, user 0Disk I/O: reads 0, writes 0Console I/O: reads 0, writes 0Paging: page faults 0, TLB misses 0Swap: COFF reads 0, swap reads 0, swap writes 0, swap skips 0Network I/O: received 0, sent 0
-
Trace the execution path by hand to find where the output is comingfrom (i.e., which classes are generating those outputstatements). Your job will be simple for this initial project, simplymodifying a print statement. Specifically, change the Nachosprint statement:
to*** thread n looped m times
*** awesome thread n looped m times
And that's it. There are no tricks or edge cases, you just needto follow the instructions.
Code Submission
For this project, each student must submit their project using ascript we provide. Go to your top-level nachos directory (not thenachos/proj0/nachos subdirectory) and runthe submit-proj0
script:
$ cd .. [assuming still in nachos/proj0 dir, cd up to the nachos/ dir]$ pwd [make sure we're in the nachos/ dir]/home/linux/ieng6/<account>/.../nachos$ ls [doubly make sure we're in the nachos/ dir]Makefile ag machine proj0 proj2 security threads vmREADME bin network proj1 proj3 test userprog$ submit-proj0$ ls -l proj0.tar.gz-rw-r----- 1 account group NNN Wed Oct * 10:23:51 202* proj0.tar.gz
If you get a "command not found" error when running submit-proj0, make sure you have run prep and also see the Troubleshooting issues section below.
The output of submit-proj0 should resemble the following. The output will not be exactly the same (e.g., file sizes will differ), and that's ok!
Source file information: source file name: proj0.tar.gz source file date: Wed Oct * 10:23:51 202* source file size: NNN bytes Copying to /home/linux/ieng6/cs120*/turnin.dest/account ............................................Done.Total bytes written: NNNPlease 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) NNN 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. There are no tricks or edge cases to test for, you just need to follow the instructions.
You will have until the posted due date to submit this project. Youcan submit as many times as you like. The last version submittedbefore 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 theform "Module(s) not found: cs120****" (e.g., when invoking prep), thentry explicitly running the following command before completing project 0:
$ module load /home/linux/ieng6/cs120fa24/public/modulefiles/cs120fa24
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 you should contact ETS to troubleshoot your account.