Scheduling Simulation

due dates: program 10/17 (email), report 10/24 (hard copy)

Write a simulation to analyze CPU scheduling algorithms. You will simulate the following schedulers:

You will need to simulate context switches as well, each of which will require 5 ms. All time units should be an integral number of milliseconds.

You may write your program in the programming language of your choice, but I must be able to run it from the Suns or my PC.


Command Line Arguments

Your program will need to specify an input filename from the command line and a single flag. The flag is optional on the command line. If it is specified, your program will produce verbose output (see below), otherwise it will produce the default output only.

Suppose you write a program called CPUSim. The command line format would be:

      CPUSim infile -v
or
      java CPUSim infile -v
where infile is the name of the file from which to read and the optional -v specifies verbose output.

Input Format

Your program will read processes from a file. The first line of the file will contain n:the number of processes to simulate which will have a value between 1 and 1000.

There will then be n lines (one for each process) containing 4 integers separated by a single space:

The lines will be ordered by the process's arrival time.

For example the input file might be:
5
1 1 5 65
2 1 10 73
3 1 15 17
4 7 20 128
35 5 25 2

Output Format

There are two output formats that your program should produce. The first is the default format, the second format will be used when your program is run with a -v on the command line. Time units in the output should be in milliseconds, but may be floating point numbers. The output described below should be all that appears on standard output (System.out, cout or stdout). Use standard error for debuggin messages (System.err, cerr, stderr).

Default Output

The default output just produces the following statistics for each of the schedulers:

Verbose Output

The verbose output will print out the default output followed by individual process statistics. For each scheduling algorithm you should output information about each process. Each of these should be on its own line which contains the following information: The line should be just numbers separated by a space with no labels.

Comments

Your code should be readable and understandable. To facilitate this you should include detailed comments about your code. You should include two varieties of comments. The standard mechanical comments will indicating what code is doing, what parameters/return values mean etc.

You will also include thematic comments. These thematic comments will describe in general terms the activities and events surrounding the "process" structure in your simulation. Document what is done to the processes, how they are manipulated, how they change. If your code tells a story, the process is the protagonist.

Thematic comments should begin with a "--". So in Java and C++ you would use //-- or /*-- to indicate the beginning of a thematic comment.


Report

A week after the program is due, you will turn in a report. The report will be a short (2 to 3 page) analysis of your results. This should include some experimentation. Build small datasets (10 to 20 processes) that produce interesting behavior in your simulation. What makes one scheduler better than another? Are there situations where two schedulers work identically?

Your report should include a brief discussion of your simulation. What design decisions did you have to make? Were there any that you feel affected the final results? Would you make a different decision if you had to do it again?

Your grade for the report will be determined by both the content and presentation of your analysis.


Grade Breakdown


Last modified: Fri Oct 03 07:47:51 Eastern Daylight Time 2003