Assume, we have the workload as shown below. All 5 processes arrive at time 0, in the order given below. The length of the CPU burst time is given in milliseconds

1 year ago
Operating System

Process    : P1    P2    P3    P4    P5

Burst time : 10    29    3    7    12
Considering the FCFS, SJF and RR (q=10 ms) scheduling algorithms, which algorithm would give the minimum average turnaround time.
Ans: The Gantt-chart for FCFS scheduling is

P1    P2    P3    P4    P5
0    10    39    42    49
61
Turnaround time = Finished Time – Arrival Time Turnaround time for process P1 = 10 – 0 = 10 Turnaround time for process P2 = 39 – 0 = 39 Turnaround time for process P3 = 42 – 0 = 42 Turnaround time for process P4 = 49 – 0 = 49 Turnaround time for process P5 = 61 – 0 = 61
Average Turnaround time = (10+39+42+49+61)/5 = 40.2 The Gantt-chart for SJF scheduling is
P3    P4    P1    P5    P2
0    3    10    20    32
61
Turnaround time for process P1 = 3 – 0 = 3 Turnaround time for process P2 = 10 – 0 = 10 Turnaround time for process P3 = 20 – 0 = 20 Turnaround time for process P4 = 32 – 0 = 32 Turnaround time for process P5 = 61 – 0 = 61
Average Turnaround time = (3+10+20+32+61)/5 = 25.2 The Gantt-chart for RR scheduling is
P1    P2    P3    P4    P5    P2    P 5    P2
0    10    20    23    30    40
50    52    61
Turnaround time for process P1 = 10 – 0 = 10

Turnaround time for process P2 = 61 – 0 = 61 Turnaround time for process P3 = 23 – 0 = 23 Turnaround time for process P4 = 30 – 0 = 30 Turnaround time for process P5 = 52 – 0 = 52
Average Turnaround time = (10+61+23+30+52)/5 = 44.2 So SJF gives minimum turnaround time.

More related questions

Questions Bank

View all Questions

Top