Tutorial 2 on CPU Scheduling Algorithms
1. Let us consider the set of 5 processes with their arrival time and burst time as given
below:
Process Id Arrival time Burst time
P1 3 1
P2 1 4
P3 4 2
P4 0 6
P5 2 3
a. If the CPU scheduling policy is SJF non-preemptive, calculate the average
turn-around time and average waiting time.
b. If the CPU scheduling policy is SJF preemptive, calculate the average turn-
around time, average waiting time and response time.
2. Given below are the set of 5 processes with their arrival time and burst
time
Process Id Arrival time Burst time
P1 0 7
P2 1 5
P3 2 3
P4 3 1
P5 4 2
a. If the CPU scheduling policy is shortest remaining time first, calculate the
average turn-around time, average waiting time and response time.
b. How many context switches are needed including context switch at time zero
and the end.
3. Consider the set of 6 processes whose arrival time and burst time are given
below-
Process Id Arrival time Burst time
P1 5 5
P2 4 6
P3 3 7
P4 1 9
P5 2 2
P6 6 3
a. If the CPU scheduling policy is Round Robin with time quantum = 2,
calculate the average turn-around time, average waiting time and response
time.
b. How many context switches are needed including context switch at the end? Do
not count the context switch at time zero.
4. Four processes to be executed on a single processor system arrived at time 0
in the order A, B, C, D. Their CPU burst time requirements are 4, 1, 8, 1 time
units respectively. What will be the completion time of A under round robin
scheduling with time slice of one-time unit? Show the Gant Chart.
5. Consider the arrival time and burst time of five different processes as given
below
Process Id Arrival time Burst time
P1 0 5
P2 1 3
P3 2 1
P4 3 2
P5 4 3
a) If the CPU scheduling policy is Round Robin with time quantum = 3 unit,
calculate the average turn-around time, average waiting time and
response time.
b) How many context switches are needed excluding the context switch at time
zero and at the end?
6. Consider following values for the arrival time, burst time and associated
priority for 5 different processes.
Process Id Arrival time Burst time Priority
P1 0 4 2
P2 1 3 3
P3 2 1 4
P4 3 5 5
P5 4 2 5
a. If the CPU scheduling policy is priority non-preemptive, calculate the
average turn-around time and average waiting time with. (Lower
number represents higher priority)
a.1) Turn-around time of P3 and P4
a.2) Waiting-time of P2, p4 and p5
b. If the CPU scheduling policy is priority preemptive, calculate the average
turn-around time, average waiting time and response time. (Higher the
number, higher the priority)
b.1) Turn-around time of P3 and P4
b.2) Waiting-time of P2, p4 and p5
b.3) How many context switches are needed including context switch at
time zero? Do not count the context switch at the end.
7. Consider the set of 5 processes whose arrival time and burst time are given
below-
Process Id Arrival time Burst time
P1 3 4
P2 5 3
P3 0 2
P4 5 1
P5 4 3
If the CPU scheduling policy is FCFS, calculate the average turn-around time and
average waiting time.