CPU burst time indicates the time, the process needs the CPU. The following are the set of processes with their respective CPU burst time (in milliseconds).
Processes CPU-burst time
P1 10
P2 5
P3 5
Calculate the average waiting time if the process arrived in the following order:
(i) P1, P2 & P3 (ii) P2, P3 & P1.
By considering the FCFS scheduling
Process Burst Time
P1 10
P2 5
P3 5
(i) Assume that the processes arrive in the order as: P1, P2 and P3
The Gantt chart for the schedule given below:
Waiting time for P1 = 0; P2 = 10 and P3 = 15
Average waiting time is: (0 + 10 + 15)/3 = 8.33 unit of time
(ii) Assume that the processes arrive in the sequence P2, P3, P1. the Gantt chart for the schedule given below:
Waiting time for P1 = 10; P2 = 0 and P3 = 5
Average waiting time is: (10 + 0 + 5)/3 = 5 unit of time.