Processes 𝑃1, 𝑃2, 𝑃3, 𝑃4 arrive in that order at times 0, 1, 2, and 8…

2025

Processes 𝑃1, 𝑃2, 𝑃3, 𝑃4 arrive in that order at times 0, 1, 2, and 8 milliseconds respectively, and have execution times of 10, 13, 6, and 9 milliseconds respectively. Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times.Β 

Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?

  1. A.

    22

  2. B.

    15

  3. C.

    37

  4. D.

    19

Attempted by 233 students.

Show answer & explanation

Correct answer: D

Turnaround Time (TAT) Calculation

Key idea: With Shortest Remaining Time First (SRTF), the CPU always runs the process with the smallest remaining burst; processes can be preempted when a shorter job arrives.

Scheduling timeline (by time intervals):

  • 0–2 ms: Process P1 starts at 0; it runs until P3 arrives at 2 (P1 has 8 ms remaining at time 2).

  • 2–8 ms: Process P3 (burst 6) has the shortest remaining time and runs to completion at 8 ms.

  • 8–16 ms: At time 8 ms P4 arrives. Among remaining processes, P1 has 8 ms, P4 has 9 ms, P2 has 13 ms; P1 is shortest and runs from 8 to 16 ms, finishing at 16 ms.

  • 16–25 ms: Next shortest is P4 (9 ms); it runs from 16 to 25 ms and finishes at 25 ms.

  • 25–38 ms: Finally P2 runs for its remaining 13 ms and finishes at 38 ms.

Completion times and turnaround times:

  • P1: arrival 0 ms, completion 16 ms β‡’ turnaround = 16 βˆ’ 0 = 16 ms

  • P2: arrival 1 ms, completion 38 ms β‡’ turnaround = 38 βˆ’ 1 = 37 ms

  • P3: arrival 2 ms, completion 8 ms β‡’ turnaround = 8 βˆ’ 2 = 6 ms

  • P4: arrival 8 ms, completion 25 ms β‡’ turnaround = 25 βˆ’ 8 = 17 ms

Average turnaround time:

Average TAT = (16 + 37 + 6 + 17) / 4 = 76 / 4 = 19 ms

Therefore the average turnaround time of the four processes is 19 milliseconds.

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

Explore the full course: Gate Guidance By Sanchit Sir