Consider the following set of processes, with the arrival times and the…

2017

Consider the following set of processes, with the arrival times and the CPU-burst times given in milliseconds

Process

Arrival Time

CPU Time

P₁

0

5

P₂

1

3

P₃

2

3

P₄

4

1

What is the average turnaround time for these processes with the pre-emptive shortest remaining processing time first (SRPT) algorithm?

  1. A.

    5.50

  2. B.

    5.75

  3. C.

    6.00

  4. D.

    6.25

Attempted by 25 students.

Show answer & explanation

Correct answer: A

At t=0, P1 starts. At t=1, P2 arrives and preempts P1 (3 < 4). At t=2, P3 arrives but P2 continues. P2 finishes at t=4. At t=4, P4 arrives and preempts P1 (1 < 3). P4 finishes at t=5. P3 runs and finishes at t=8. P1 finishes at t=12. Turnaround times are 12, 3, 6, 1. Average is (12+3+6+1)/4 = 5.50.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir