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?
- A.
22
- B.
15
- C.
37
- 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.