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:
- Design and implement a CPU trace generator (20%)
- Design and implement a CPU Scheduling Simulator (80%)
Use the CPU trace generator to generate jobs (or process) traces and
simulate the following algorithms
- Shortest remaining time next (aka Shortest Job First with
pre-emption, aka SJF, shortest next burst time).
- 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)
- 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:
- numberOfJobs
- JobId_1 [space] arrivalTime [space] numberofIORequests [space] [Priority]
Followed by
-
burstTime_1
-
burstTime_2
-
burstTime_3
-
...
-
burstTime_numberofIORequests IOTime_numberOfIORequests
- JobId_2 [space] arrivalTime [space] numberofIORequests [space] [Priority]
Followed by
-
burstTime_1
-
burstTime_2
-
burstTime_3
-
...
-
burstTime_numberofIORequests
- ...
- JobId_numberOfJobs [space] arrivalTime [space] numberofIORequests
[space] [Priority]
Followed by
-
burstTime_1
-
burstTime_2
-
burstTime_3
-
...
-
burstTime_numberofIORequests
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:
- Predominantly I/O bound jobs (interactive)
- Predominantly CPU bound jobs (batch)
Your simulation should output the following statistics:
- Average throughput measured in jobs per time unit
- Average turnaround time measured in time units
- Average response time measured in time units (the same as
the average waiting time).
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:
- Turn in your tarred, gzipped file by emailing it as
an attachment to
cs446@cs.unr.edu and...
- 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