COP4610 - Fall 1997 - P1 - First Programming Assignment

Objectives

  1. Learn to use JavaSOS, an operating system simulator.
  2. Learn Java!
  3. Explore the JavaSOS system call mechanism by adding a new system call.
  4. Become familiar with the JavaSOS source code environment.

Deadlines and Deliverables

E-mail a copy of your modified JavaOS files complete with a journal to cop4610@cs.fsu.edu, by Wednesday, September 10th at 4 PM.

The journal is a document containing your documentation of your progress during the assignment. The easiest way to manage your journal is to create a text file in the same directory as the assignment and treat it like a diary -- record your efforts, trials and victories as you solve the problem. In cases where you are unable to completely solve the problem the journal is used to possibly enhance your grade by determining whether or not you were on the right track. In addition, the journal will contain any information that may be required by the assignment.

The method for emailing your solution is to create a uuencoded compressed tar image of only the files you changed. This way the grader can just uudecode, uncompress, and un-tar your files on top of an unmodified JavaOS source tree and your files will drop into place for easy grading. For example, assuming that you modified the files SOSSyscallIntHandler.java and AppTests.java, then you would turn in your assignment like this (substitute "tar" for "gnutar" if you are on a Linux machine):

cd
cd cop4610/P1
gnutar czvf ~/P1.tar.gz SOSSyscallIntHandler.java AppTests.java P1.journal
cd
uuencode P1.tar.gz < P1.tar.gz 
      | /usr/ucb/mail -s "P1 submission" cop4610@cs.fsu.edu

Don't forget to include your journal file in the tar file!

Grading

This project will be graded on a scale of 0-100.

Getting Started

You need to change your UNIX environment to use JDK 1.1.3. Perform the following steps:

In your .cshrc and .tcshrc file change the PATH statement to include
the path "/usr/local/java/bin".

In your .cshrc and .tcshrc add this line:

setenv SHELL /bin/tcsh

The following steps will install an entire working copy of the JavaSOS simulator into your home directory and build the simulator from the source code.

cd
mkdir cop4610
chmod 700 cop4610
cd cop4610
mkdir P1
chmod 700 P1
cd P1
gnutar xzvf ~jtbauer/jsosP1.tar.gz
make

To run the simulator, do the following:

java SIM

The simulator will run as described in the Guide to the Java Version of SOS available in class and from the class home page. A text file named sim.out is created that contains all the trace messages from the simulation run.

Assignment

Your assignment is to first gain some experience and familiarity with the simulator. Secondly, you are to modify the operating system by adding a new system call that implements the process Wait() primitive (see SimpleWait() on page 44 of the book).

Assignment - Part 1

Run the simulator on all three of the sample programs (the "2 GUI Apps", the "Msg App" and the "Disk App") with full tracing enabled (turn on "Trace App", "Trace HW", "Trace SIM", "Trace Syscall", "Trace PM" and "Trace Disk" for each run). Save the sim.out file between runs and turn these in with your P1 journal. Try to find the SIM.Trace() calls within the source that matches each of the lines of output in the sim.out files to get a feel for the control flow of the simulator. You will find the section entitled Control Flow in Java SOS in the Guide to the Java Version of SOS helpful.

Assignment - Part 2

Add support for the Wait() system call. As described in the textbook (page 44), the Wait() system call is used by a parent process to suspend it's execution until a particular child process has exited.

Use the following definition in SOSSyscallIntHandler.java for the new system call:

static final int WaitProcessSystemCall = 8;

You will need to modify one of the existing three sample programs to add in the WaitProcessSystemCall for testing. I chose the "2 GUI Apps" (source code is in AppGUICounter.java). Determine a logical place to put the WaitProcessSystemCall within this file for your testing.

The actual WaitProcessSystemCall does not need to return the Exit value from the child process, as the SimpleWait() system call does, so you do not have to keep track of the ExitProcessSystemCall return code. Your code does, however, need to take into account a parent that executes the WaitProcessSystemCall after the child the parent wants to wait for has exited via the ExitProcessSystemCall. In other words, account for a parent that doesn't get around to waiting for a child until after the child has long gone.

If your coding is correct the behavior of the 2 GUI apps should be the following:

Hints

Since this assignment involves getting into code you've probably never seen before I will provide you with the following hints:

You will find it useful to insert SIM.trace() calls while debugging.

You can also use the source-code level Java debugger by invoking:

jdb SIM

Information on how to use the debugger can be found in the Java Tutorial as well as by typing help from within jdb.

The solution I wrote required changing the following files: