The following instructions assume that you have copied and compiled the Nachos software using Handout 5: Laboratory Instructions, as well as read Handout 4.
For this assignment, you will only need to modify files in the threads directory. In particular, the files you are most concerned with are threadtest.cc, synch.cc, and synch.h. Part 1 of the assignment requires you to modify synch.h and synch.cc; parts 2, 3 and 4 each require you to modify threadtest.cc. Your first step is to make a copy of this file and keep it under some other name for reference (e.g. threadtest.cc.orig), and then modify threadtest.cc as needed for each part of the assignment. In addition, you should surround your changes with the ifdef CHANGED directive. The variable CHANGED is defined by default in Makefile.common in the code directory.
When you finish one part of the assignment, you can create an executable file by typing gmake depend, follwed by gmake nachos. These commands will create an executable file called nachos in the threads directory. When you are sure your program works, rename this executable and your source files to some other names, (e.g., part2 and producer.cc) and start working on other parts of the assignment. For each part of the assignment, start with and modify a copy of the original version of threadtest.cc. This method will prevent you from needing to modify the makefile.
For the purposes of grading, create a directory /cs377/lab2 in in your account. When you are ready to submit your lab, place the following files in that directory:
part1: synch.h, synch.cc part2: producer.cc, producer.h, input.txt, part2 part3: wash.cc, wash.h, part3 part4: water.cc, water.h, part4
Where part2, part3, part4 are the executable files for each part of the assignment. Note that no executable is required for part 1.
Also note that part 2 of the assignment needs an input file. Call this file input.txt which should give interesting results. We may also test your program with other input file(s) as well.
It is very important that you keep all files in the directory
/cs377/lab2 in your home directory. If this
directory does not exist, you will lose points towards your
assignment. To help you understand what kind of output to expect from
your programs, we have attached a sample output from working
solutions.
When your submission is ready, you will need to set permissions so the graders can access your files. Here is what you need to do to set the permissions : type cd /cs377. Then type chmod -R 775 * The first command takes you back to your course directory and the second recursively sets permissions for all files and directories in your course directory the way the graders need them.
Last, but not the least, Use only the delux machines in the edlab to compile your program. Do not work on the alpha machines. A good way to check this is to type machine at the prompt - if the shell responds by saying mips, you are working on the right machine.
Again, if you are having trouble with the assignment, please see the TA in office hours or at the discussion section.