Module 2.4
Module 2.4
If the processes arrive in the order P1, P2, P3, and are
served in FCFS order, we get the result shown in the
following ‘Gantt chart’, which is a bar chart that
illustrates a particular schedule, including the start and
finish times of each of the participating processes:
P1 P2 P4 P3
0 8 12 17 26
The waiting time for process P1: P1 started at 0, P1 arrived
at 0. So waiting time for P1 in first slot is (0-0) = 0.
For process P2, started at 8, but arrived at 1, So waiting
time is (8-1) = 7 milliseconds
For process P3, started at 17, but arrived at 2, So waiting
time is (17-2) = 15 milliseconds
For process P4, started at 12, but arrived at 3, So waiting
time is (12-3) = 9 milliseconds
Average waiting time is (0+7+15+9)/4 = 7.75
milliseconds.
From Gantt chart, we can directly calculate the average
waiting time as
[(0-0) + (8-1) + (17-2) + (12-3)] / 4 = 7.75 milliseconds
Preemptive SJF (SRTF) schedule is as depicted in the
following Gantt chart:
(End of Module 2)
*****