GATE - 2016 | OS | Consider the following processes, with the arrival time and the length

GATE - 2016 | OS | Consider the following processes, with the arrival time and the length
Posted on 09-02-2022

GATE - 2016 [Operating System]

Question:

Consider the following processes, with the arrival time and the length of the CPU burst given in milliseconds. The scheduling algorithm used is preemptive shortest remaining-time first.

Consider the following processes, with the arrival time and the length of the CPU burst given in milliseconds. The scheduling algorithm used is preemptive shortest remaining-time first.

The average turn around time of these processes is _________ milliseconds.

 

A

8.25

B

8.26

C

8.27

D

8.28

  

Solution:

Option (A) is Correct.

Here the scheduling algorithm used is preemptive shortest remaining-time first.
To answer the question we need to design the Gantt chart:

Consider the following processes, with the arrival time and the length of the CPU burst given in milliseconds. The scheduling algorithm used is preemptive shortest remaining-time first.

In this algorithm, the processes will be scheduled on the CPU which will be having the least remaining burst time.
Turnaround Time (TAT) = Completion Time (CT) - Arrival Time (AT)
TAT for P1 = 20 - 0 = 20,
TAT for P2 = 10 - 3 = 7,
TAT for P3 = 8 - 7 = 1,
TAT for P4 = 13 - 8 = 5.
Total TAT = 20 + 7 + 1 + 5 = 33 / 4 = 8.25 (Avg. TAT)

Thank You