Next: The Assignment Up: No Title Previous: No Title

Understanding the Nachos Software, Part II

For this lab, you will be working mostly in the userprog directory. The first step is to read and understand the part of the system we have written for you. For this lab, you will test your system call implementation by running user programs on Nachos. At present, Nachos can run a single user-level `C' program at a time. As a test case, we've provided you with a trivial user program, `halt'; all halt does is to turn around and ask the operating system to shut the machine down. Run the program nachos -x ../test/halt from the userprog directory. As before, trace what happens as the user program gets loaded, runs, and invokes a system call.

The files for this assignment are listed below. You will need to understand all of these files for the fourth lab as well.

progtest.cc -
test routines for running user programs.

addrspace.h, addrspace.cc -
create an address space in which to run a user program, and load the program from disk.

syscall.h -
the system call interface: kernel procedures that user programs can invoke.

exception.cc -
the handler for system calls and other user-level exceptions, such as page faults. In the code we supply, only the `halt' system call is supported.

filesys.h, openfile.h
- (found in the filesys directory) a stub defining the Nachos file system routines. For this assignment, we have implemented the Nachos file system by directly making the corresponding calls to the UNIX file system.

translate.h, translate.cc -
translation table routines. In the code we supply, every virtual address is the same as its physical address - this memory management scheme means you may only execute one user program at a time.

machine.h, machine.cc -
emulates the part of the machine that executes user programs: main memory, processor registers, etc.

mipssim.cc -
emulates the integer instruction set of a MIPS R2/3000 processor.

console.h, console.cc -
emulates a terminal device using UNIX files. A terminal is (i) byte oriented, (ii) incoming bytes can be read and written at the same time, and (iii) bytes arrive asynchronously (as a result of user keystrokes), without being explicitly requested.

So far, all the code you have written for Nachos has been part of the operating system kernel. In a real operating system, the kernel not only uses its procedures internally, but allows user-level programs to access some of its routines them via ``system calls''.

In this assignment, we give you a simulated CPU that models a real CPU. In fact, the simulated CPU is the same as a real CPU (a MIPS chip), but we cannot just run user programs as regular UNIX processes, because we want complete control over how many instructions are executed at a time, how the address spaces work, and how interrupts and exceptions (including system calls) are handled.

Our simulator can run normal programs compiled from C - see the Makefile in the `test' subdirectory for an example. The compiled programs must be linked with some special flags, then converted into Nachos format, using the program ``coff2noff'' (which we supply). The only caveat is that floating point operations are not supported. This feature enables you to make your own test programs, which we encourage you to do and share with your classmates.



Next: The Assignment Up: No Title Previous: No Title


archna@mimas.cs.umass.edu
Tue May 13 12:29:19 EDT 1997