GATE / CS ARCHIVE

GATE CSE 2025 SET 2 / QUESTION 26

GATE CSE 2025 Set 2 Q26

Operating Systems · CPU Scheduling · Full GATE CSE 2025 Set 2 paper

GATE 2025 Set 2, Q26 1 mark · MCQ
Report issue

CPU Scheduling

Question 26, GATE 2025: Processes P1,P2,P3,P4 arrive at times 0,1,2,8 ms and require 10,13,6,9 ms of CPU time respectively. Scheduling uses preemptive Shortest Remaining Time First with no context-switch cost. Find average turnaround time.
Options: A. 22 ms; B. 15 ms; C. 37 ms; D. 19 ms.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Step through it (7 steps)

Track remaining time at each arrival rather than comparing original burst times throughout. At t=0 only P1 is available. At t=1 P1 has 9 ms left, less than P2's 13, so P1 continues. At t=2 P1 has 8 ms left and P3 arrives needing 6; P3 preempts it and runs from 2 to 8.

At t=8 P3 completes and P4 arrives. Remaining times are P1:8, P2:13, P4:9, so choose P1 for 8…16. Next choose P4 for 16…25, followed by P2 for 25…38. The execution intervals are therefore P1 [0,2), P3 [2,8), P1 [8,16), P4 [16,25), P2 [25,38).

Turnaround equals completion minus arrival: P1=16−0=16, P2=38−1=37, P3=8−2=6, P4=25−8=17 ms. Their sum is 76 ms and the average is 76/4=19 ms. Waiting time would subtract each burst as well; that is not the requested metric. Answer: D.

Original paper, page 21 · Answer key