GATE / CS ARCHIVE

GATE CSE 2021 SET 1 / QUESTION 25

GATE CSE 2021 Set 1 Q25

Operating Systems · CPU Scheduling · Full GATE CSE 2021 Set 1 paper

GATE 2021 Set 1, Q25 1 mark · NAT
Report issue

CPU Scheduling

Question 25, GATE 2021: Three processes arrive at time zero with CPU bursts 16,20,10 milliseconds. With prior burst knowledge and non-preemptive scheduling, what is the minimum average waiting time, rounded to the nearest integer in milliseconds?
Tap to enlarge
Answer & solution

Official answer: 12

Shortest-job-first minimizes total waiting time when all jobs arrive together and burst lengths are known. Execute bursts 10, 16, 20. Their waiting times are 0, 10, 26, whose average is 36/3=12 milliseconds.

For three jobs of lengths a,b,c in that order, total waiting is 0+a+(a+b)=2a+b. Placing shorter jobs earlier minimizes this weighted sum. More generally, swapping adjacent lengths x>y reduces the waiting total by x−y while leaving later completion times unchanged. This exchange argument proves shortest-job-first is optimal here. Completion/turnaround times would be 10,26,46 and are not the requested waiting times.

Original paper, page 22 · Answer key