GATE / CS ARCHIVE

GATE CSE 2016 SET 2 / QUESTION 47

GATE CSE 2016 Set 2 Q47

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

GATE 2016 Set 2, Q47 2 marks · NAT
Report issue

CPU Scheduling

Question 47, GATE 2016: Preemptive shortest-remaining-time-first schedules P1(arrival 0,burst 10), P2(3,6), P3(7,1), P4(8,3), all times ms. Find average turnaround time.
Tap to enlarge
Answer & solution

Official answer: 8.2 : 8.3

Our answer: 8.25

Step through it (7 steps)

SRTF executes P1: 0–3, P2: 3–7, P3: 7–8, P2: 8–10, P4: 10–13, P1: 13–20. Turnaround times are 20−0=20, 10−3=7, 8−7=1, 13−8=5. Average33/4=8.25ms, within the official 8.2–8.3 interval.

At time 3, P1 has 7 ms left, so arriving P2 with 6 preempts it. At time 7, P2 has 2 left, so P3 with 1 preempts. At time 8, P2’s remaining 2 beats P4’s 3 and P1’s 7. Turnaround includes all waiting after arrival; average waiting would instead subtract each burst and yield 3.25 ms.

Original paper, page 39 · Answer key