Project 172 - Scheduling Algorithm Performance


The scheduling of processes is an important part of making our computer efficient, and hence fast. We are going to write a scheduling simulator to measure what differences scheduling can make.

The Simulator

You will write a scheduling simulator that will implement three different scheduling algorithms: round robin, shortest job first, and shortest job remaining. You may use whatever programming language you like. If you need additional programs or libraries installed on mclovin, please email me with the name of the appropriate apt-get package. You must provide a working version on mclovin, though you do not have to do your work there.

Running the program

Your program should accept the following arguments:

<program name> <scheduling algorithm> [optional algorithm parameter] [verbose] <process time file n>*

where:

scheduling algorithm is one of the following:

  • RR: round robin
  • SJF: shortest job first
  • SJR: shortest job remaining

parameter is an parameter present only for round robin that specifies the time quantum a process should run.

verbose is an optional parameter that produces additional trace output as described below.

process time file is the name of a file containing process run information. Note that there may be an unlimited number of these files provided on the command line. Each file will be named in the format process-N.txt, where N is an integer between 1 and 65535. Each file has the format:

start 0
B 120
I 4200
B 100
I 3700
B 110
end

where B is the burst time in microseconds, and I is the time the process is blocked and unable to run, also in microseconds. Some processes may have a start time that is later than zero; they should not be included in your scheduling decisions until after their arrival.

Limitations

When doing SJF or SJR, you need to consider the burst time of the process. The natural thing you will want to do is look at the burst time in the file. You cannot do this. In the real world, we do not get to ask the process what its burst time is - we can only predict what is coming up based on what happened in the past. You must therefore limit your burst time prediction to what you have determined based on past performance. For ties, schedule the lower process number first.

Output

When the verbose option is not enabled, your program needs only print out what process runs in what time interval, in the format:

<process number> <start time> <end time>.

You may assume that scheduling and switching processes takes zero time.

For example, assume we had two processes, 1 and 2, with the same pattern of behavior shown above. For SJF, your output would look like:

1 0 120
2 120 240
Idle 240 4320
1 4320 4420
2 4420 4520
Idle 4520 8200
1 8200 8310
2 8310 8420
end

If the verbose option is specified, you must provide additional information. Each time you make a scheduling decision you should print the current time and, for SJF or SJR, what your current modelled burst time is for each process. For RR, along with the current time you should show the state of your queue, that is what order you expect to schedule processes in the near future.

What to turn in:

You will e-mail me two things prior to class:
  • A text file describing how to compile and execute your program. This will also include a path to a compiled and executable (or interpretable) version that I can test on mclovin.
  • The code of your simulator.