CSC 539: Operating Systems Structure and Design
Spring 2006

HW3: CPU Scheduling


  1. Exercises from the book: 5.2, 5.3, 5.4, 5.5 and 5.7.

  2. 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).

    5 0 1 2 12 4 2 1 25 14 3 4 100 25 4 0 2 39 5 4 80 55 6 3 22

    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).