CS 3733 Operating Systems, Fall 2008 Assignment 3


Due Monday, October 20

This assignment is based on the process scheduling simulators that you used in Assignments 1 and 2.

The simulator you used in Assignment 2 and in the recitations normally creates processes using probability distributions for the CPU and I/O bursts. If you want to do an experiment with specific values for these as you did with the simulator you wrote in Assignment 1, you can do that also. For example, the files below can be used to run the simulator for Test 1 of Assignment 1.
    myrun.run
    myexp.exp
    cpu.1
    cpu.2

To specify a list of values instead of a distribution in a run file, use the key word user followed by a file name. The format of the file is a list of numeric tokens separated by white space. The first token is the number of remaining tokens in the file and the other tokens are the values used. If the simulator needs more than the number of values given, it reuses these values in a circular fashion.

In the examples above, there are 2 CPU bursts and one I/O burst. The files cpu.1 and cpu.2 each contain three tokens. The first token is 2, indicating that there are 2 additional tokens to read. This is followed by the 2 CPU burst values. Since there is only one I/O burst, we do not need a list. We can specify that the I/O burst is constant.

The duration field in myrun.run determines when the processes terminate. In each case it is a constant value which is the sum of the two CPU bursts used. This guarantees that the process will terminate after the second CPU burst.

Part 0
Make a new directory for this part of the assignment. Run he simulator with the 4 files above. You can do this by untarring the assign2.tar file into this directory and then copying the four files above into that directory (overwriting myrun.run and myexp.exp). When you run the simulator it should reproduce the results of Test 1 of Assignment 1.

Now modify the files so that it will do Test 2 instead.

Part 1
We know that the average waiting time (AWT) of SJF is usually at least as good as the AWT of FCFS and the AWT of PSJF is usually at least as good as the AWT of SJF. Notice that Test 1 is unusual in that the AWT of FCFS is strictly smaller than that of SJF. However, PSJF still beats both of them in this test.

Answer the following question as best you can. You must justify your answer to the best of your ability. This is an open-ended question and you can use whatever method you like to answer it.

Hint: If you have Assignment 1 working, you can write a program that calls SJF and PSJF for a large number of tests to see what happens. You can probably run several million tests in a few seconds. There are only 6 parameters of interest. Although your computer is not fast enough to try all of them (since there are infinitely many) you might be able to find one that does what you want.

Part 2
Consider the same question as in Part 1, but with three processes. They all arrive at the same time and each has two CPU bursts and one I/O burst in between. Is it possible to find an experiment of this type in which SJF has a smaller AWT than PSJF? Again, you can use any method you like, but you must justify your answer. These experiments can be run on my simulator from Assignment 2. You can also do them using a slight modification of your program from Assignment 1. If you implemented these using a state machine, the modification should not be too difficult.

If you do find such an experiment, show that it works by running it on my simulator. Produce a log file containing the table data and Gantt charts for SJF and PSJF. You can also include the output from your simulator if you like, but that is not required.

Handing in your assignment
Use this cover sheet. Consecutively number all of the pages you turn in.