# An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of pro

355 views
in Computer
closed

An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):

 Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5

The average waiting time (in milliseconds) of the process is _____

by (41.0k points)
selected

Gantt chart:

 Process P1 P2 P2 P3 P3 P4 P1 Time(AT to CT ) 0 to 2 2 to 3 3 to 6 6 to 8 8 to 12 12 to 17 17 to 27

Calculating average waiting time:

 Process Arrival time (AT) Burst Time (BT) Completion time (CT) Turnaround time (TAT) Waiting Time (WT) P1 0 12 27 27 15 P2 2 4 6 4 0 P3 3 6 12 9 3 P4 8 5 17 11 4

Average waiting time $= \frac{{15\; + \;0\; +\; 3\; + \;4}}{4} = \frac{{22}}{4} = 5.5$

Hence 5.5 is the correct answer.

Important Point:

TAT = CT – AT

WT = TAT – BT