GATE / CS ARCHIVE

SUBJECT COLLECTION

Operating Systems · CPU Scheduling

40 questions, newest first

GATE CSE has asked 40 questions on CPU Scheduling (Operating Systems) from 1993 to 2026, in 34 of the 46 papers; the most recent is in GATE CSE 2026 Set 2. In the last five years it carried 1.4 marks per 100-mark paper on average, against 1.4 since 2003. Since 2014 the questions have been 11 NAT, 7 MCQ and 2 MSQ. 5 groups of questions here are solved the same way; “One per method” keeps the newest of each.

Browse topics
2 marks · NAT
Report issue

FCFS waiting times in arrival order

CPU Scheduling

Question 64, GATE 2026: Actuator processes A require 6 CPU seconds and arrive at times 10,20,30,40,50. Controller processes C require 8 seconds and arrive at 11,22,33,44,55. FCFS scheduling is nonpreemptive and the first A starts at 10. Find the average waiting time of all ten processes to one decimal place.
Tap to enlarge
Answer & solution

Official answer: 9.5

Step through it (19 steps)

Givens and goal

Actuator processes A require 6 CPU seconds and arrive at times 10,20,30,40,50. Controller processes C require 8 seconds and arrive at 11,22,33,44,55. FCFS scheduling is nonpreemptive and the first A starts at 10. Find the average waiting time of all ten processes to one decimal place.

Approach

Merge arrivals chronologically and use start=max(arrival, previous finish), wait=start−arrival for each row.

Step-by-step solution

1. The chronological order is A1,C1,A2,C2,A3,C3,A4,C4,A5,C5. FCFS serves them in exactly this order, without preempting a current process when a new one arrives.
2. Compute starts and finishes sequentially. For A1, start=10, finish=16 and wait=0. C1 arrived at 11 but must wait until 16, so its wait is 5 and finish is 24. Continue the same recurrence:

    Process   Arrival   Burst   Start   Finish   Wait
    A1           10       6       10      16       0
    C1           11       8       16      24       5
    A2           20       6       24      30       4
    C2           22       8       30      38       8
    A3           30       6       38      44       8
    C3           33       8       44      52      11
    A4           40       6       52      58      12
    C4           44       8       58      66      14
    A5           50       6       66      72      16
    C5           55       8       72      80      17

3. Total waiting time is 0+5+4+8+8+11+12+14+16+17=95 seconds. Divide by ten processes to get 95/10=9.5 seconds.
4. Waiting time excludes the process’s own CPU burst. Using finish−arrival would give turnaround time instead. There is no idle gap after the first process starts: at each completion, the next process in the table has already arrived.

Original paper, page 46 · Answer key

1 mark · MCQ
Report issue

Identifying non-preemptive scheduling

CPU Scheduling

Question 23, GATE 2026: Which CPU scheduling algorithm cannot be preemptive under its standard definition? A SRTF; B FCFS; C Round Robin; D Priority.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Givens and goal

Which CPU scheduling algorithm cannot be preemptive under its standard definition? A SRTF; B FCFS; C Round Robin; D Priority.

Approach

Distinguish the order of selecting ready jobs from taking the CPU away mid-burst.

Step-by-step solution

1. FCFS serves ready processes in order of arrival. Once selected, a process continues until it finishes its CPU burst or voluntarily blocks. Standard FCFS does not preempt that burst.
2. SRTF chooses the smallest remaining execution time. If a shorter job arrives, it may preempt the current job; this is the preemptive form of shortest-job scheduling.
3. Round Robin explicitly preempts when a time quantum expires and places an unfinished process back in the ready queue. Priority scheduling can be defined either with immediate higher-priority preemption or with selection only at release points.
4. Thus B is the intended answer. A hardware interrupt or a process blocking for I/O is not, by itself, evidence that the scheduler uses a preemptive FCFS policy.

Original paper, page 18 · Answer key

2 marks · MCQ
Report issue

Scheduling processes on two priority-ordered CPUs

CPU Scheduling

Question 38, GATE 2025: Four processes arrive at time 0 with CPU bursts P1=20, P2=16, P3=25, P4=10 ms. Scheduling is non-preemptive. M1 priority order is P1>P3>P2>P4; M2 order is P2>P3>P4>P1. A free processor chooses the highest-priority waiting process in its own order; a process runs on only one processor. Ignore switching overhead. Average waiting time? A 9.00; B 8.75; C 6.50; D 7.50 ms.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Build a timeline of processor release events, selecting only among processes still waiting at each event.
At t=0, M1 selects P1 and M2 selects P2. Neither process waits. Their completion times are 20 and 16 respectively.
At t=16, M2 becomes free while P3 and P4 are waiting. M2 ranks P3 above P4, so P3 begins at 16 and finishes at 41. At t=20, M1 becomes free; P3 is already running and cannot be scheduled again, so M1 begins P4, which finishes at 30.
Because all arrivals are at zero and scheduling is non-preemptive, waiting times equal start times: P1=0, P2=0, P3=16, P4=20. Their average is (0+0+16+20)/4=9.00 ms, option A.
Completion times must not be averaged as waiting times, and priority orders are applied only to eligible waiting processes, not to processes already executing elsewhere.

Original paper, page 38 · Answer key

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

2 marks · MCQ
Report issue

Compare preemptive and nonpreemptive shortest-job schedules

CPU Scheduling

Question 37, GATE 2024: Four processes have (arrival,burst): A(0,10), B(2,6), C(4,3), D(6,7). Find average waiting times for SRTF and nonpreemptive SJF. A 6,7; B 6,7.5; C 7,7.5; D 7,8.5.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (2 schedules)

Approach: Draw a separate timeline for each policy, then use waiting=completion−arrival−burst.

1. Derivation. SRTF runs A0–2, B2–4, C4–7, B7–11, D11–18, A18–26. Completion times A26, B11, C7, D18 give waiting times 16, 3, 0, 5 after subtracting arrival and burst, average 24/4=6. Nonpreemptive SJF runs A0–10, C10–13, B13–19, D19–26, giving waiting times 0, 11, 6, 13 and average 30/4=7.5. Answer B. D’s arrival at 6 does not preempt C, whose remaining time is 1.

2. Explanation and checks. For SRTF, at time 2 A has 8 left and B needs 6, so B preempts A. At time 4 B has 4 left and C needs 3, so C preempts B. At time 6 C needs only 1 more, so D does not preempt it. In nonpreemptive SJF, A cannot be displaced after starting at time 0; when it finishes at 10 all others are ready and C is shortest. These decisions explain the difference in the two timelines.

Original paper, page 25 · Answer key

1 mark · MSQ
Report issue

CPU Scheduling

Question 27, GATE 2023: Which scheduling policies can cause starvation? A FIFO; B round robin; C priority scheduling; D shortest job first. Preserve all answer sets accepted in the official key.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C, D or C, D

Our answer: C;D under finite-burst FIFO; A;C;D also officially accepted

Priority scheduling can indefinitely postpone a low-priority process when higher-priority work keeps arriving. SJF can similarly starve a long job under a continuing supply of shorter jobs. Round robin provides recurring turns under its usual finite-quantum assumptions. Ordinary FIFO with finite earlier jobs does not starve a waiting job, giving C, D. If an earlier nonpreemptive FIFO job never relinquishes the CPU, a later job can wait forever; the official key additionally accepts A, C, D. Preserve both accepted sets rather than silently selecting one.

Teaching detail. Starvation means indefinite postponement despite continuing operation, rather than a long but finite waiting time. Under conventional finite service times, FIFO eventually reaches each queued job, whereas higher priorities or shorter new jobs can repeatedly overtake an eligible job under the other policies. Round robin with finite quanta and the ordinary finite active-set assumptions revisits each ready process. The official acceptance of a second set including FIFO must not be erased by applying only the conventional model. The nonterminating FIFO-job scenario explains one possible model distinction, not an official stated rationale.

Original paper, page 25 · Answer key

2 marks · MCQ
Report issue

CPU Scheduling

Question 42, GATE 2022: P,Q,R,S arrive at time zero in that order. Round-robin quantum is 4. Observed switches include exactly one S→Q, one R→Q, two Q→R and no S→P, counting switches after termination too. Which burst tuple (P,Q,R,S) is impossible? A (4,10,6,2); B (2,9,5,1); C (4,12,5,4); D (3,7,7,3).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

With quantum 4, A, B, C each give execution segments P, Q, R, S, Q, R, Q: P and S finish in their first turn, R in its second, and Q in its third. This yields two Q→R switches, one R→Q and one S→Q. For D, burst times (3, 7, 7, 3) instead give P, Q, R, S, Q, R: Q finishes on its second turn, leaving no final R→Q switch. Thus D cannot produce the stated trace.

For option D the slices have lengths 3,4,4,3,3,3 respectively. The running order P,Q,R,S,Q,R has Q→R twice and S→Q once, but no R→Q. For A the slice lengths are 4,4,4,2,4,2,2, so P,Q,R,S,Q,R,Q satisfies all stated counts. B,C have that same order because Q needs three turns and R two.

Original paper, page 27 · Answer key

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

1 mark · MSQ
Report issue

CPU Scheduling

Question 14, GATE 2021: Select correct CPU scheduling statements: A turnaround includes waiting; B goal is only maximize CPU use and minimize throughput; C round robin works without advance CPU burst lengths; D preemption requires hardware support.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A; C; D

Turnaround measures arrival-to-completion and includes waiting, so A. Throughput should ordinarily be increased, not minimized, refuting B. Round-robin only needs a time quantum, not advance knowledge of each burst, giving C. Preemption of an otherwise running process requires hardware interruption support, typically a timer interrupt, giving D in the standard OS model.

For an ordinary CPU-only job, turnaround=completion−arrival=waiting+CPU service; I/O time is also included if relevant. Round robin dispatches a ready job for at most a quantum, regardless of its remaining burst. A timer interrupt lets the OS regain control even if the process does not voluntarily yield.

Original paper, page 62 · Answer key

2 marks · NAT
Report issue

CPU Scheduling

Question 50, GATE 2020: All processes arrive at time 0. Burst times: P1=8,P2=7,P3=2,P4=4 ms. Compare SJF with RR, quantum 4 ms and initial order P1,P2,P3,P4. Find the absolute difference in average turnaround times, to two decimal places.
Tap to enlarge
Answer & solution

Official answer: 5.25

Step through it (2 schedules)

Worked explanation

Turnaround time is completion minus arrival, not just waiting time. With all arrivals zero, completion times can be averaged directly. SJF Gantt timeline: 0—P3—2—P4—6—P2—13—P1—21. RR timeline: 0—P1—4—P2—8—P3—10—P4—14—P1—18—P2—21. After their first slices P1 has 4 ms remaining and P2 has 3; P3 and P4 finish in their first slices and leave the queue. In process order P1,P2,P3,P4, completions are (21,13,2,6) for SJF and (18,21,10,14) for RR. Sums 42 and 63 divided by 4 give the required difference 5.25 ms.

Derivation and answer

SJF executes P3, P4, P2, P1, completing them at 2, 6, 13, 21ms. Since arrivals are all zero, average turnaround is 42/4=10.5ms. RR with quantum 4 executes P1[0, 4], P2[4, 8], P3[8, 10], P4[10, 14], P1[14, 18], P2[18, 21]. Completion times are 18, 21, 10, 14ms, averaging 63/4=15.75ms. The absolute difference is 15.75−10.5=5.25ms, with zero context-switch overhead as conventionally assumed.

Original paper, page 15 · Answer key

2 marks · NAT
Report issue

Inferring a burst time under SRTF

CPU Scheduling

Question 41, GATE 2019: Four processes have (arrival, CPU burst) in ms: P1=(0,3), P2=(1,1), P3=(3,3), P4=(4,Z). Under preemptive shortest-remaining-time-first scheduling their average waiting time is 1 ms. Determine Z.
Tap to enlarge
Answer & solution

Official answer: 2

1. SRTF always runs the available process with least unfinished CPU time. P1 runs from 0 to 1, leaving 2 ms. P2 arrives at 1 with burst 1, preempts P1, and finishes at 2.
2. P1 resumes at 2. When P3 arrives at 3, P1 has only 1 ms left versus P3's 3 ms, so P1 continues to completion at 4. P1 has waited 1 ms; P2 has waited 0; P3 has already waited 1.
3. At time 4, P4 arrives. If Z<3, P4 runs first for Z ms, then P3 runs for 3 ms. The total waiting time is W1+W2+W3+W4=1+0+(1+Z)+0=2+Z.
4. Average waiting 1 over four processes requires total waiting 4. Thus 2+Z=4, giving Z=2, which satisfies the branch assumption Z<3.
5. Check the other branch: if Z≥3, running P3 first adds a wait of 3 to P4, giving total 1+0+1+3=5. For Z=3 either tie order gives the same total, so this branch cannot give average 1.
6. With Z=2, completion times are P1=4, P2=2, P4=6, P3=9. Using waiting=completion−arrival−burst gives 1,0,0,3 respectively, totaling 4. Answer 2 ms.

Original paper, page 13 · Answer key

1 mark · NAT
Report issue

CPU Scheduling

Question 24, GATE 2017: Processes P1,P2,P3,P4 have (arrival,CPU burst) in ms: (0,7),(3,3),(5,5),(6,2). Use preemptive shortest-remaining-time-first scheduling and find average waiting time.
Tap to enlarge
Answer & solution

Official answer: 3.0

Our answer: 3

Step through it (7 steps)

1. Run P1 at t=0. At t=3 it has 4 ms left, so newly arrived P2 with 3 ms preempts it. At t=5 P2 has only 1 ms left, less than P3’s 5, so P2 continues to completion at 6.

2. At t=6 choose P4’s 2 ms over P1’s 4 and P3’s 5. P4 completes at 8, P1 runs 8–12, then P3 runs 12–17.

3. Waiting=completion−arrival−burst. For P1,P2,P3,P4 these are 12−0−7=5,6−3−3=0,17−5−5=7,8−6−2=0. Average=(5+0+7+0)/4=3 ms.

Original paper, page 12 · Answer key

2 marks · NAT
Report issue

CPU Scheduling

Question 51, GATE 2017: Processes have (arrival time,CPU burst,priority), all times in ms: P1:(0,11,2), P2:(5,28,0), P3:(12,2,3), P4:(2,10,1), P5:(9,16,4). Priority 0 is highest, there are no I/O bursts, and scheduling is preemptive priority with zero unspecified switching overhead. Find average waiting time.
Tap to enlarge
Answer & solution

Official answer: 29.0

Our answer: 29

Step through it (10 steps)

1. P1 starts at 0. At 2, higher-priority P4 arrives and preempts it; P1 has 9 ms left. At 5, highest-priority P2 arrives and preempts P4, which has 7 ms left. P2 runs uninterrupted to 33; later arrivals P5 and P3 have lower priorities.

2. Among waiting processes, run P4 from 33–40, P1 from 40–49, P3 from 49–51, then P5 from 51–67. Completion times are C1=49,C2=33,C3=51,C4=40,C5=67.

3. With no I/O, waiting time equals completion minus arrival minus CPU burst. Thus W1=49-0-11=38; W2=33-5-28=0; W3=51-12-2=37; W4=40-2-10=28; W5=67-9-16=42. The total is 145, so the average is 145/5=29 ms. Do not confuse waiting time with turnaround, which also includes execution.

Original paper, page 21 · Answer key

1 mark · MCQ
Report issue

CPU Scheduling

Question 20, GATE 2016: CPU-bound processes with unequal burst lengths all arrive simultaneously. Which scheduling policy minimizes average ready-queue waiting time? A: shortest remaining time first. B: round robin with quantum shorter than every burst. C: uniform random. D: highest priority first, with priority proportional to burst length.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

All processes are available initially and are CPU-bound, so shortest-remaining-time-first reduces to shortest-job-first. If a longer job immediately precedes a shorter one, swapping them reduces the sum of waiting times by the burst-length difference. Repeated exchanges yield increasing burst order, which is optimal. Thus A.

Suppose adjacent bursts have lengths a>b. Executing a before b contributes a to b's wait, whereas reversing them contributes b to a's wait; completion time of the pair and waits of later jobs stay unchanged. The swap decreases total wait by a−b. Eliminating all such inversions gives ascending burst order. Since all arrivals occur at time zero, no newly arriving short job triggers a distinct preemption issue; SRTF executes this same optimal order.

Original paper, page 10 · Answer key

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

2 marks · NAT
Report issue

CPU Scheduling

Question 52, GATE 2015: A preemptive uniprocessor runs periodic T1,T2,T3 with periods 3,7,20 ms and execution times 1,2,4 ms. Shorter period means higher priority. All first jobs arrive at the beginning of millisecond 1. At the end of which millisecond does first T3 finish?
Tap to enlarge
Answer & solution

Official answer: 12

Set time zero at that initial arrival. T1 releases at 0,3,6,9; T2 at 0,7. First T3 starts at 4 after T1,T2,T1 consume four units, gets two units until time 6, then waits while T1,T2,T1 run through time 10. It completes its remaining two units in [10,12). Thus the finish is the end of the twelfth millisecond, not the beginning of millisecond 12. No context-switch overhead is supplied.

Solution: With time 0 at the beginning of the first millisecond, rate-monotonic priorities are T1>T2>T3. Execute T1: 0–1, T2: 1–3, T1: 3–4, T3: 4–6, T1: 6–7, T2: 7–9, T1: 9–10, T3: 10–12. The first T3 job receives its required 4ms and finishes at time 12, the end of the twelfth millisecond. Context-switch overhead is unspecified and taken as zero.

Original paper, page 20 · Answer key

2 marks · MCQ
Report issue

CPU Scheduling

Question 57, GATE 2015: Processes have (arrival time, processing time): A=(0,3), B=(1,6), C=(4,4), D=(6,2). Which scheduling scheme yields the lowest average turnaround time? Options: (A) first come first serve; (B) non-preemptive shortest job first; (C) shortest remaining time; (D) round robin with quantum 2. Turnaround time is completion minus arrival.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (4 schedules)

1. Shortest remaining time runs A0–3, B3–4, C4–8, D8–10 and B10–15 (the C/D tie at 6 can be resolved either way without changing total turnaround).

2. Completion-minus-arrival times are 3, 14, 4, 4, mean 6.25. FCFS gives 3, 8, 9, 9, mean 7.25; nonpreemptive SJF gives 3, 8, 11, 5, mean 6.75. Round-robin quantum 2 gives a larger mean (8.25 under arrivals-before-requeue at equal times). Hence C.

Original paper, page 75 · Answer key

2 marks · NAT
Report issue

CPU Scheduling

Question 32, GATE 2014: Five processes have (arrival time, execution time), in ms: A=(0,6), B=(3,2), C=(5,4), D=(7,6), E=(10,3). Under preemptive shortest-remaining-time-first on one CPU, find the average turnaround time in ms.
Tap to enlarge
Answer & solution

Official answer: 7.2

Step through it (9 steps)

1. Method and setup. Reevaluate the currently running process whenever a new process arrives. Compare remaining execution time, not the original burst length. Record completion time for each process, then subtract its own arrival time; averaging completion times directly would ignore that the processes enter at different times.

2. Work through the result and its assumptions. SRTF executes A0–3, B3–5, A5–8, C8–12, E12–15, D15–21. At10, C has 2 remaining versus E’s3, so it continues. Completion-minus-arrival times are 8, 2, 7, 14, 5. Their mean 36/5=7.2ms.

Original paper, page 15 · Answer key

2 marks · NAT
Report issue

CPU Scheduling

Question 32, GATE 2014: Processes A,B,C each repeat 100 iterations of a CPU burst followed by independent-device I/O. CPU burst times are A 100 ms, B 350 ms, C 200 ms; all I/O operations take 500 ms. They arrive at 0,5,10 ms respectively. With round-robin scheduling, 50 ms quantum, no scheduling overhead, and sufficient independent I/O devices, when does C finish its first I/O, in ms from time 0?
Tap to enlarge
Answer & solution

Official answer: 1000

Step through it (16 steps)

1. Set up the reasoning. Maintain the ready queue at quantum boundaries. Later arrivals join the queue but do not preempt A's already running time slice. Remove a process from the ready queue as soon as its CPU burst finishes and it blocks on I/O.

2. Derive the result. The50ms slices are A0–50, B50–100, C100–150, A150–200, B200–250, C250–300, B300–350, C350–400, B400–450, C450–500. A starts I/O at 200; C completes its 200ms CPU burst at 500 and its independent 500ms I/O at 1000.

3. Check the interpretation. C needs four 50-ms slices, not four consecutive slices. Its I/O can overlap A's and other CPU activity because separate devices are available; add 500 ms to C's CPU completion time rather than to its arrival.

Original paper, page 38 · Answer key

2 marks · NAT
Report issue

CPU Scheduling

Question 32, GATE 2014: Preemptive shortest-remaining-time-first scheduling is applied to processes (arrival,CPU burst), in ms: P1=(0,12), P2=(2,4), P3=(3,6), P4=(8,5). Find their average waiting time.
Tap to enlarge
Answer & solution

Official answer: 5.5

Step through it (8 steps)

Step 1: P1 runs 0–2, leaving 10. P2 arrives with burst 4 and preempts it. At time 3, P2 has 3 remaining, shorter than P3's 6, so P2 finishes at 6. Step 2: P3 then runs 6–12. When P4 arrives at 8, P3 has 4 remaining, less than P4's 5, so no preemption occurs. P4 runs 12–17, then P1 runs 17–27. Step 3: Waiting time equals completion−arrival−burst: P1=27−0−12=15; P2=6−2−4=0; P3=12−3−6=3; P4=17−8−5=4. The average is (15+0+3+4)/4=5.5 ms, assuming negligible switching cost.

Original paper, page 60 · Answer key

1 mark · MCQ
Report issue

Waiting-time priority scheduling

CPU Scheduling

Question 10, GATE 2013: All processes arrive at time 0, have no I/O, and start with zero priority. Priority is proportional to accumulated waiting time. Every T time units priorities are reevaluated and the next process is selected. Which policy is equivalent? A FCFS; B round-robin; C shortest-job-first; D shortest-remaining-time-first.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Our answer: B under the usual cyclic tie convention

With all jobs arriving together and no blocking, running a process stops its waiting time from growing while the others continue to accumulate waiting time. At each T-unit reassessment, the previously waiting processes take priority over the one just served. With a fixed fair cyclic resolution of ties this is round-robin with quantum T, B. The statement does not independently specify how equal priorities are ordered, so an exact fixed cyclic order requires that usual tie convention.

For processes that remain ready, elapsed time equals CPU service received plus accumulated waiting time. At a fixed reassessment time, maximizing waiting time is therefore the same as favoring the process that has received the least service. Starting together, the unserved processes outrank the one just given a T-unit slice. With consistent cyclic tie-breaking, each gets a slice before that process gets another, reproducing round-robin. Neither job lengths nor remaining times are consulted, excluding SJF/SRTF. FCFS would let the first job keep running rather than preempt it at each reassessment.

Original paper, page 3 · Answer key

2 marks · MCQ
Report issue

FCFS and round-robin completion order

CPU Scheduling

Question 31, GATE 2012: Consider the 3 processes, P1, P2 and P3 shown in the table.

                                       Process       Arrival       Time Units
                                                     time          Required
                                       P1            0             5
                                       P2            1             7
                                       P3            3             4

        The completion order of the 3 processes under the policies FCFS and RR2 (round robin scheduling
        with CPU quantum of 2 time units) are
        (A) FCFS: P1, P2, P3 RR2: P1, P2, P3                 (B) FCFS: P1, P3, P2 RR2: P1, P3, P2
        (C) FCFS: P1, P2, P3 RR2: P1, P3, P2                 (D) FCFS: P1, P3, P2 RR2: P1, P2, P3
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (2 schedules)

FCFS executes P1 from 0–5, P2 from 5–12 and P3 from 12–16, so completion order is P1, P2, P3. For quantum 2, round robin runs P1 0–2, P2 2–4, P1 4–6, P3 6–8, P2 8–10, P1 10–11, P3 11–13, P2 13–15 and 15–16. Completion times are respectively 11, 16, 13, giving P1, P3, P2. Hence C.

Check: The arrivals occur between quantum boundaries: P2 joins during P1’s first slice, and P3 joins during P2’s first slice. A preempted unfinished process returns to the tail, whereas a completed process is removed. This explains why the shorter P3 finishes before P2 under RR.

Original paper, page 7 · Answer key

2 marks · MCQ
Report issue

Preemptive shortest-remaining-time schedule

CPU Scheduling

Question 35, GATE 2011: Processes P0,P1,P2 have (arrival,burst) times in ms of (0,9),(1,4),(2,9). Use preemptive shortest-job-first scheduling, reconsidering at arrivals or completions. What is their average waiting time?

(A) 5.0 ms
(B) 4.33 ms
(C) 6.33 ms
(D) 7.33 ms
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (6 steps)

P0 runs 0–1, then P1 with its shorter remaining time runs 1–5 despite P2 arriving at 2. P0 finishes its remaining 8 units during 5–13; P2 then runs 13–22. Waiting times are 13−0−9=4, 5−1−4=0 and 22−2−9=11. Average(4+0+11)/3=5ms, A.

At time 1, P0 has 8 units remaining and P1 needs 4, so preemption is required. At time 2, P1 has only 3 remaining, less than P0's 8 and newly arrived P2's 9, so no further preemption occurs. Waiting time is turnaround minus burst, not completion time alone. P0 waits from 1 to 5, P1 never waits, and P2 waits from 2 to 13. These intervals independently reproduce the total 15 ms waiting time.

Original paper, page 9 · Answer key

1 mark · MCQ
Report issue

Scheduling starvation and responsiveness

CPU Scheduling

Question 25, GATE 2010: Which statements about CPU scheduling are true? I: shortest-remaining-time-first may cause starvation. II: preemptive scheduling may cause starvation. III: round robin is better than FCFS in response time.
Options: (A) I only; (B) I and III only; (C) II and III only; (D) I,II and III.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

SRTF may indefinitely postpone a long job when shorter jobs keep arriving, so I is true. SRTF is itself preemptive, establishing that preemptive scheduling may cause starvation, so II is true. Round robin’s time slices let waiting jobs receive CPU service without waiting for a long earlier job to finish, which is the conventional interactive response-time advantage asserted by III. The intended answer is all three, D. III is a qualitative textbook comparison, not a strict improvement for every workload and quantum; for a quantum exceeding all bursts, RR reduces to FCFS.

Starvation means unbounded waiting, not merely a long finite delay. Under SRTF, a long job can be repeatedly preempted by a stream of shorter jobs. Round robin uses a bounded quantum to distribute service opportunities among ready jobs, which improves typical interactive first-response behavior, while potentially increasing context-switch cost. The word “may” in I and II is essential.

Original paper, page 6

1 mark · MCQ
Report issue

Scheduling algorithm applications

CPU Scheduling

Question 16, GATE 2007: Match CPU scheduling algorithms P: Gang, Q: Rate Monotonic, R: Fair Share with applications 1: Guaranteed Scheduling, 2: Real-time Scheduling, 3: Thread Scheduling.
Options:
(A) P-3,Q-2,R-1
(B) P-1,Q-2,R-3
(C) P-2,Q-3,R-1
(D) P-1,Q-3,R-2
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Approach. Gang scheduling groups collaborating threads; rate monotonic assigns priorities from task periods; fair share divides capacity between users or groups rather than only individual runnable processes.

2. Derivation and interpretation. Gang scheduling coordinates related threads, P→3. Rate-monotonic priorities schedule periodic real-time tasks, Q→2. Fair-share scheduling aims to guarantee users/groups an allocated CPU share, R→1. Thus A.

Original paper, page 4

2 marks · MCQ
Report issue

Shortest remaining time scheduling and waiting time

CPU Scheduling

Question 55, GATE 2007: Shortest Remaining Time first schedules four processes: P1 arrives at 0 and requires 20 units; P2 at 15 requires 25; P3 at 30 requires 10; P4 at 45 requires 15. What is P2’s total waiting time?
Options:
(A) 5
(B) 15
(C) 40
(D) 55
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step through it (8 steps)

1. Approach. At each arrival compare remaining service, not original burst lengths. Draw the execution intervals and count only the intervals after P2 arrives during which it is ready but not running.

2. Derivation and interpretation. P1 runs from 0 to 20: at P2's arrival at 15, P1 has only 5 units left versus P2's 25. P2 runs 20–30, leaving 15; P3 then arrives with 10 and runs 30–40. P2 resumes at 40. When P4 arrives at 45, P2 has 10 left versus P4's 15, so P2 continues until 55. Its waiting intervals are 15–20 and 30–40, totaling 5+10=15 (B). Equivalently completion−arrival−execution=55−15−25=15.

Original paper, page 13

1 mark · MCQ
Report issue

SRTF process switches

CPU Scheduling

Question 6, GATE 2006: Three CPU-bound processes arrive at times 0,2,6 and need 10,20,30 time units respectively. With shortest-remaining-time-first scheduling, how many context switches occur, excluding initial dispatch at time 0 and final termination?
Options:
(A) 1
(B) 2
(C) 3
(D) 4
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. At time 2 the first process has 8 units remaining, less than the new 20. At time 6 it has 4 remaining, less than 30.

2. It therefore runs 0–10, followed by the 20-unit process 10–30 and the 30-unit process 30–60. Excluding initial dispatch and final exit leaves two process switches, B.

3. Teaching check: Draw the CPU timeline 0–10:P1, 10–30:P2, 30–60:P3. An arrival is not automatically a preemption: compare its burst with the current remaining time. Only the changes P1→P2 and P2→P3 count under the exclusions in the question.

Original paper, page 1

2 marks · MCQ
Report issue

Longest remaining time first turnaround

CPU Scheduling

Question 64, GATE 2006: Processes with IDs 0,1,2 all arrive at time zero and need 2,4,8 compute units respectively. Use longest-remaining-time-first, reevaluated each time unit, with ties favoring the lower ID. What is average turnaround time?
Options:
(A) 13
(B) 14
(C) 15
(D) 16
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Using one-unit scheduling steps and breaking ties by the lower process ID, the running process IDs for times 0 through 13 are 2,2,2,2,1,2,1,2,0,1,2,0,1,2. Completion times are 12,13,14 for IDs 0,1,2.

2. Since arrivals are all zero, mean turnaround=(12+13+14)/3=13 units, A. This uses the intended discrete time-unit model; ideal continuous reevaluation at every instant would require a separate tie-sharing convention.

3. Teaching check: Turnaround equals completion time because every arrival is zero. LRTF initially favors the eight-unit process, but its remaining time eventually ties the four-unit process and the tie rule changes the schedule. Computing each completion time is safer than averaging burst lengths or waiting times alone.

Original paper, page 9

2 marks · MCQ
Report issue

CPU idle fraction with overlapped I/O

CPU Scheduling

Question 65, GATE 2006: Three processes arrive at time zero with total activity durations 10,20,30. Each spends its first 20% in I/O, next 70% computing, and last 10% in I/O. I/O overlaps as much as possible. The CPU chooses the shortest remaining compute burst when its current process blocks or completes its burst. What percentage of the entire elapsed interval is CPU-idle?
Options:
(A) 0%
(B) 10.6%
(C) 30.0%
(D) 89.4%
Question 65, GATE 2006: Three processes arrive at time zero with total activity durations 10,20,30. Each spends its first 20% in I/O, next 70% computing, and last 10% in I/O. I/O overlaps as much as possible. The CPU chooses the shortest remaining compute burst when its current process blocks or completes its burst. What percentage of the entire elapsed interval is CPU-idle?
Options:
(A) 0%
(B) 10.6%
(C) 30.0%
(D) 89.4%
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. The three initial I/O bursts last 2,4,6; compute bursts last 7,14,21; final I/O bursts last 1,2,3. CPU is idle 0–2, executes process 1 during 2–9, process 2 during 9–23, and process 3 during 23–44.

2. Their final I/O finishes at 10,25,47. Over the complete 47-unit elapsed interval, CPU idle time is 2+3=5, hence 100×5/47≈10.6%, B.

3. The question continues on physical page 10.

4. Teaching check: The initial I/O phases overlap, so their elapsed cost is not 2+4+6 in series. While the first process computes, the other initial I/Os finish. The final three-unit I/O of the last process extends the completion horizon beyond the final CPU burst, producing additional CPU-idle time.

Original paper, page 9

2 marks · MCQ
Report issue

Preemptive shortest remaining time

CPU Scheduling

Question 46, GATE 2004: Processes (arrival time,CPU burst), in ms, are P1=(0,5), P2=(1,3), P3=(2,3), P4=(4,1). What is the average turnaround time under preemptive shortest remaining processing time first (SRPT)?
Options:
(A) 5.50 ms
(B) 5.75 ms
(C) 6.00 ms
(D) 6.25 ms
Question 46, GATE 2004: Processes (arrival time,CPU burst), in ms, are P1=(0,5), P2=(1,3), P3=(2,3), P4=(4,1). What is the average turnaround time under preemptive shortest remaining processing time first (SRPT)?
Options:
(A) 5.50 ms
(B) 5.75 ms
(C) 6.00 ms
(D) 6.25 ms
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Step through it (7 steps)

1. A valid SRPT schedule is P1:[0,1), P2:[1,4), P4:[4,5), P3:[5,8), P1:[8,12). P2 still has the smallest remaining time when P3 arrives.

2. Completion times for P1,P2,P3,P4 are 12,4,8,5; subtracting arrivals 0,1,2,4 gives turnaround times 12,3,6,1. Their mean is 22/4=5.50ms.

3. Teaching check: Turnaround is completion minus arrival, not total waiting time. The four turnaround values are 12,3,6,1; their sum is 22. Context-switch overhead is not supplied and is therefore excluded. Arrival of P3 at time 2 does not preempt P2, whose remaining burst is only 2.

Original paper, page 6

2 marks · MCQ
Report issue

Scheduling alternating CPU and I/O bursts

CPU Scheduling

Question 77, GATE 2003: A uniprocessor runs only two processes, created nearly simultaneously. Each alternates a 10 ms CPU burst with a 90 ms I/O burst; their I/O can proceed in parallel. Which policy gives the least long-run CPU utilization?
A. First come, first served
B. Shortest remaining time first
C. Static priority with different priorities
D. Round robin with a 5 ms quantum
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Ignore switching overhead as the statement supplies none. Under FCFS one process runs 0–10 and the other 10–20. Their I/O ends at 100 and 110, and each finishes its next CPU burst just as the other becomes ready. Thus the CPU supplies 20 ms work per 100 ms: 20% utilization. SRTF and distinct priorities have the same sustained burst staggering here.
2. Under 5 ms round robin, the initial slices are P:0–5, Q:5–10, P:10–15, Q:15–20. Their I/O begins at 15 and 20, only 5 ms apart, and ends at 105 and 110.
3. With the usual ordering when I/O completion coincides with quantum expiry, Q gets the CPU at 110, so the next completed CPU bursts are at 120 and 125. This repeats the paired pattern after 105 ms.
4. Utilization is 20/105≈19.05%, less than 20%, making D the conventional answer. The smaller separation causes more simultaneous I/O and hence more CPU idle time.

Solution: Ignoring context-switch cost, FCFS, shortest-remaining-time, and distinct static priorities run the two initial CPU bursts consecutively for 10 ms each. Their I/O completions stay offset by 10 ms, giving 20 ms of CPU work in a 100 ms steady-state period. With round robin at a 5 ms quantum, the initial bursts finish at 15 and 20 ms, so the processes enter I/O only 5 ms apart. Under the usual ready-queue ordering at simultaneous quantum expiry and I/O completion, this pattern repeats every 105 ms, giving utilization 20/105≈19.05%, below 20%. Thus D is the conventional answer: fine time slicing makes their long I/O intervals overlap more.

Original paper, page 11

1 mark · MCQ
Report issue

Nonpreemptive scheduling policy

CPU Scheduling

Question 1.22, GATE 2002: Which scheduling method is nonpreemptive?
(A) Round robin; (B) First-in first-out; (C) Multilevel queue scheduling; (D) Multilevel queue scheduling with feedback.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step 1: Identify the event that removes the running process.

Step 2: Under FIFO, arrival of another ready process does not by itself interrupt the current one. The current process relinquishes the CPU by blocking or finishing. Round robin deliberately introduces timer preemption. A multilevel policy needs additional rules before one can decide whether it preempts, so its name is not an unconditional alternative to FIFO.

Conclusion: FIFO/FCFS lets the running job continue until it blocks or completes, so B. Round robin preempts at a time quantum. Multilevel scheduling families depend on their specified interqueue and intraqueue policies and are not, by name alone, the fixed nonpreemptive policy sought.

Original paper, page 3

1 mark · MCQ
Report issue

Scheduling for completion throughput

CPU Scheduling

Question 1.19, GATE 2001: Given n tasks with known runtimes r1,…,rn on one processor, which policy maximizes throughput: round robin, shortest-job-first, highest-response-ratio-next, or FCFS? Explain the throughput interpretation needed.
Tap to enlarge
Your answer
Answer & solution

Answer: B under the finite-horizon completion interpretation (no official key was published)

Step 1: If all jobs are ready and their runtimes are known, the k shortest jobs have the minimum possible total runtime among all k-job subsets. Executing them first therefore completes as many jobs as possible by each time horizon, under zero overhead and no blocking. This favors SJF, B.

Step 2: However, if throughput means the entire fixed batch’s n completions divided by its total processing time, every work-conserving order gives n/(r1+…+rn). Under that definition no unique scheduler maximizes it.

The answer therefore needs the finite-horizon or average-completion interpretation; it must not claim SJF reduces the sum of all CPU bursts.

Original paper, page 3

2 marks · MCQ
Report issue

Round-robin waiting-time constraint

CPU Scheduling

Question 2.17, GATE 1998: n processes share CPU; switches cost s seconds and quantum is q. Minimize overhead while each process gets a turn at least every t seconds. Options use q≤or≥(t−ns)/(n−1) or denominators n+1.
Tap to enlarge
Your answer
Answer & solution

Answer: A for maximum off-CPU waiting; start-to-start wording differs (no official key was published)

After a process’s quantum ends, n−1 other quanta occur before it runs again. Including the n intervening switches gives waiting time (n−1)q+ns. Requiring this≤t yields q≤(t−ns)/(n−1), A, for n>1 and feasible t>ns. Switching overhead fraction decreases as q grows, so choose equality to minimize it within that constraint. If “every t seconds” instead measures successive start times, the interval includes the process’s own quantum: n (q+s)≤t, giving q≤t/n−s. The listed answer assumes off-CPU waiting, not literal start-to-start spacing.

Original paper, page 5

Descriptive
Report issue

Minimum average job response

CPU Scheduling

Question 24(a), GATE 1998: Four jobs with expected run times 6,3,5,x are waiting. In what order should they run to minimize average response time?
Question 24(a), GATE 1998: Four jobs with expected run times 6,3,5,x are waiting. In what order should they run to minimize average response time?
Tap to enlarge
Answer & solution

Answer: Shortest expected processing time first, subject to standard all-arrived nonpreemptive assumptions. (no official key was published)

Assume one processor, all four jobs ready at time zero, no scheduling overhead, and response interpreted as time to completion (or waiting time to first execution under nonpreemptive execution). Consider adjacent jobs of lengths a>b starting at time t. Their completion-time sum in order a,b is (t+a)+(t+a+b)=2t+2a+b. Reversing them gives 2t+2b+a, smaller by a−b. Other jobs' completion times do not change, because the pair's total length is unchanged. Repeatedly removing inversions proves ascending processing time is optimal.

Thus for x≥0: if x≤3, use x,3,5,6; if 3≤x≤5, use 3,x,5,6; if 5≤x≤6, use 3,5,x,6; if x≥6, use 3,5,6,x. Ties can be broken either way. For random run times the same exchange proof minimizes expected mean completion using their expected durations, when the decision is a fixed order and those expectations are known.

The answer is not a universal interactive-response policy: different release times, preemption or defining response as first service with arbitrarily small time slices changes the optimization problem. These are not specified, so the conventional nonpreemptive model is stated.

Original paper, page 8

1 mark · MCQ
Report issue

A running-to-ready transition

CPU Scheduling

Question 1.18, GATE 1996: A process-state diagram includes ready→running, running→ready, running→blocked and blocked→ready. What scheduler feature does the usual diagram indicate?
Tap to enlarge
Your answer
Answer & solution

Answer: B: preemptive scheduling (no official key was published)

Dispatch moves a ready process into running. An I/O or resource wait moves it into blocked, and completion moves it back to ready. In the standard scheduling diagram, the extra running→ready edge represents the scheduler taking the CPU away, for example at time-slice expiry. That is preemption, giving B. A real system may also let a process voluntarily yield into ready; the unlabeled graph alone would then not prove involuntary preemption. The answer uses the conventional interpretation of this textbook state-transition diagram.

Original paper, page 3

2 marks · MCQ
Report issue

Completion time under round robin

CPU Scheduling

Question 2.20, GATE 1996: At time 0, jobs A,B,C,D arrive in that order with CPU bursts 4,1,8,1. With quantum 1 and no overhead, when does A complete?
Question 2.20, GATE 1996: At time 0, jobs A,B,C,D arrive in that order with CPU bursts 4,1,8,1. With quantum 1 and no overhead, when does A complete?
Tap to enlarge
Your answer
Answer & solution

Answer: D: time 9 (no official key was published)

The first four one-unit slices execute A,B,C,D, ending at time 4. B and D have now finished; A has three units left and C has seven. The next slices are A from 4–5, C from 5–6, A from 6–7, C from 7–8, and A from 8–9. A’s fourth unit therefore finishes at time 9. Counting four slices for A alone would ignore the CPU time given to other ready jobs. The result assumes the stated arrival order determines the initial queue and there is no context-switch cost.

Original paper, page 6

1 mark · MCQ
Report issue

Scheduling for time sharing

CPU Scheduling

Question 1.15, GATE 1995: Which policy is most suitable for a time-shared OS: shortest job first, round robin, FCFS or elevator?
Tap to enlarge
Your answer
Answer & solution

Answer: B: round robin (no official key was published)

Round robin gives each ready process a bounded time slice and cycles through the queue. This prevents one long CPU-bound job from monopolizing the processor and supports responsive interactive use. FCFS can make short interactive requests wait behind a long job. SJF requires burst predictions and can disadvantage long jobs; elevator is chiefly a disk-head scheduling rule. Round robin is therefore the standard choice here, with quantum size balancing response time against context-switch overhead.

Original paper, page 2

2 marks · MCQ
Report issue

Intentional idling for a scheduling objective

CPU Scheduling

Question 2.6, GATE 1995: Nonpreemptive jobs (arrival,burst) are 1:(0,9),2:(0.6,5),3:(1,1). Which listed sequence is optimal, with how much idle time?
Tap to enlarge
Your answer
Answer & solution

Answer: A: [3,2,1],idle 1, for minimum total completion/turnaround time (no official key was published)

Wait until time 1, run job 3 to time 2, job 2 to time 7 and job 1 to time 16. Completion times sum to 25. For each of the six orders, starting each job as early as its order permits gives sums 38,34,27.8,35.8,25,29 respectively for 123,132,231,213,321,312. Thus 321 minimizes their sum and leaves the CPU idle for one initial time unit. Subtracting fixed arrival times shows the same order minimizes mean turnaround and waiting time. The source says “optimal” without specifying this objective; minimizing makespan alone would instead avoid initial idling.

Original paper, page 3

2 marks · MSQ
Report issue

Round-robin completion of p

CPU Scheduling

Question 7.10, GATE 1993: At time 0 jobs p,q,r,s,t arrive in that order with bursts 4,1,8,1,2. Quantum is 1. Find p’s completion time.
Tap to enlarge
Select all that apply
Answer & solution

Answer: C: 11 (no official key was published)

The first round executes p,q,r,s,t from time 0 to 5; q and s then finish. The second round runs p from 5–6,r from 6–7,t from 7–8, completing t. The remaining queue is p,r. They run p8–9,r9–10,p10–11. This is p’s fourth unit, so it completes at 11. Context-switch overhead is assumed zero, and the arrival order determines the initial queue. A simple burst-only count would miss the intervening slices consumed by the other ready jobs.

Original paper, page 8