Discussion questions: CPU scheduling

Please work out these problems before your next discussion section. The GSIs and IAs will go over these problems during the discussion section.

1. Response times for different scheduling algorithms

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds and with their priorities (larger priority numbers imply higher priority, and, in case of a tie, you can assume first-come-first- serve ordering). The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
Job Size (time) Priority
P1 10 3
P2 1 1
P3 2 3
P4 1 4
P5 5 2

Consider the following scheduling algorithms: First-Come-First-Served, Round-Robin (with quantum = 1), Shortest-Time-to-Completion-First, and a Non-preemptive priority. Assume context switching is free.

a. For each scheduling algorithm, show a timeline of when jobs run, and compute the response times for each job.

b. Which algorithm gives the lowest average response time?

2. Advantages and disadvantages of different scheduling algorithms

Consider typical considerations in designing CPU scheduling algorithms such as scheduling overhead, starvation/fairness, average response time, CPU utilization, and throughput. Discuss the advantages and disadvantages of the following scheduling algorithms: STCF, FCFS, round robin, non-preemptive priority, earliest-deadline first. Remember that the suitability of an algorithm often depends on the workload.