CSC 539: Operating Systems Structure and Design
Spring 2006
HW3: CPU Scheduling
Exercises from the book:
5.2, 5.3, 5.4, 5.5 and 5.7.
Modify the CPUScheduler simulator from HW2 so that it models
priority scheduling. Each job should have a priority associated with it, with 0 being the
highest possible priority. The first line in the data file should contain a single positive
integer, identifying the range of priorities. For example, the following data file
is assumed to contain jobs whose priorities range from 0 up to 4. Each subsequent line in
the file defines characteristics of a job: arrival time, ID, priority, and length (in that order).
Your modified simulator should store jobs in multiple queues, organized by priority, and
perform round-robin scheduling within the queues. That is, if a job is available with
priority 0, it should be loaded and will execute until it times out or finishes.
Only if there is no job available with priority 0 will a job with priority 1 be loaded and
executed, and so on down to the lowest priority. As before, the simulator should display
messages whenever a job loads, starts, times out, or finishes. Also, the CPU utilization and
average time to completion for each priority class should be displayed at the end of the simulation
(by the displayStats method).