Assignment 4


Objective Understanding and implementing cpu scheduling algorithms. Understanding the power of simulations in evaluating competing algorithms.

There are two portions to the assignment:

  1. Design and implement a CPU trace generator (20%)
  2. Design and implement a CPU Scheduling Simulator (80%)
Use the CPU trace generator to generate jobs (or process) traces and simulate the following algorithms
  1. Shortest remaining time next (aka Shortest Job First with pre-emption, aka SJF, shortest next burst time).
  2. Round-Robin with user set-able time quantum (the time quantum should be a user set-able command line parameter. Default time quantum is 20 time units)
  3. Lottery scheduling with all processes getting an equal proportion of the CPU (probabilistically).
Graduate students will need to also implement Priority scheduling with three priority queues and round robin within each queue. The time quantum should once again be user set-able and a command line parameter.

The CPU trace generated by your CPU trace generator must have the following format:

Your CPU scheduling simulator should read this trace and simulate the algorithms listed above. You want to test your program with a mix of 2 - 20 jobs and (the same) two test cases (traces) for each algorithm:
  1. Predominantly I/O bound jobs (interactive)

  2. Predominantly CPU bound jobs (batch)

Your simulation should output the following statistics:

Here's a sample trace file Check Ekkasit's page for more trace files.

Frequently asked questions about the assignment. As you pose questions I will post clarifications on the webpage.

Extra Credit: Do the assignment in Java and document your code using Javadoc

The assignment will be discussed in class and I encourage you to ask questions.

Turning in your assignment

There is a slight change in how you will be turning in your assignment. You will turn in two things:

  1. Turn in your tarred, gzipped file by emailing it as an attachment to
    cs446@cs.unr.edu
    and...
  2. Print a hardcopy of 1) your source, 2) our two test traces (I will post a link to these soon), and 3) the result of running your code on our two test traces and hand them in before start of class on the due date.

Sushil Louis
Last modified: Mon Mar 22 12:17:03 PST 2004