CIS 657 Lab 1
Submit your Lab 1 document (doc or pdf) including the disclosure form and answers to the Turnitin link on the blackboard (under Assignments).
Due: Sep. 14 (Friday, end of the day)
Late submission: you have total 72 hours throughout the semester.
Download Nachos.tar from the blackboard and unpack it. Answer all of the following questions by examining the Nachos code (all sub-directories of code directory).
(1) (5pts) What are the possible NachosProcess (called Thread) states and where are they defined (filename & line number)?
(2) (5 pts) In threadtest.cc, how many lines are printed when you change:
for(int num = 0; num < 5; num++)
to
for(int num = 0; num < which; num++)
Why is that?
(3) (10 pts) Draw the call graph of creating a new NachoProcess with SimpleThread function.
(4) (25 pts) Using flags will help you design and test your operating system (later in other labs and programming assignments).
To use a flag: ./nachos -flag <flag parameters>
Examine source code for all the predefined flags and discuss briefly how Nachos operates and what information is displayed if it exists for each flag and its parameter(s).
(5) (10pts) What system calls are currently implemented in Nachos? Explain what it does in detail and find a corresponding UNIX system call if exists.
(6) (15pts) What would happen when you execute the halt program (code/test/halt.c) – ./nachos -x ~/test/halt? Explain why it happens. Draw the call graph from a user program (halt) instruction to running a system call implementation.
(7) (10 pts) What would happen when you execute the shell program (code/test/shell.c)? Explain why it happens.
(8) (5pts) Which emulated MIPS CPU register contains the system call code?
(9) (15 pts) Explain the difference between the threads created in ThreadTest() and the thread created for executing halt (or shell).