CPU Scheduling · Operating System
37 questions · asked in 24 of 27 years (2000–2026)
MCQ 24 · MSQ 2 · NAT 111-mark 21 · 2-mark 16
2000Questions per year2026
Questions 6–10 of 37
Which one or more of the following CPU scheduling algorithms can potentially cause starvation?
One or more options are correct.
Answer: (C), (D)
Starvation means some process can wait forever. Assume that every process that gets the CPU finishes its burst.
- FIFO: processes run in order of arrival, so each process only waits for the ones before it, and they all finish. No starvation.
- Round Robin: every process in the queue gets a time slice in each cycle. No starvation.
- Priority scheduling: a low-priority process can wait forever if higher-priority processes keep arriving.
- SJF: a long job can wait forever if shorter jobs keep arriving.
Answer: (C), (D)
- FIFO: processes run in order of arrival, so each process only waits for the ones before it, and they all finish. No starvation.
- Round Robin: every process in the queue gets a time slice in each cycle. No starvation.
- Priority scheduling: a low-priority process can wait forever if higher-priority processes keep arriving.
- SJF: a long job can wait forever if shorter jobs keep arriving.
Answer: (C), (D)
Consider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time t = 0. There is exactly one context switch from S to Q, exactly one context switch from R to Q, and exactly two context switches from Q to R. There is no context switch from S to P. Switching to a ready process after the termination of another process is also considered a context switch. Which one of the following is NOT possible as CPU burst time (in time units) of these processes?
Answer: (D)
Let us run round robin (quantum 4, order P, Q, R, S) on the burst times P = 3, Q = 7, R = 7, S = 3.
- P runs for 3 units and finishes Q runs for 4 units (3 left) R runs for 4 units (3 left) S runs for 3 units and finishes
- Q runs for 3 units and finishes R runs for 3 units and finishes
The context switches are: PQ, QR, RS, SQ, QR. There is no R Q switch, but exactly one is needed. So these burst times cannot work.
(If we run the other three sets of burst times, we get exactly one SQ, one RQ, two QR and no SP.)
Answer: P = 3, Q = 7, R = 7, S = 3
- P runs for 3 units and finishes Q runs for 4 units (3 left) R runs for 4 units (3 left) S runs for 3 units and finishes
- Q runs for 3 units and finishes R runs for 3 units and finishes
The context switches are: PQ, QR, RS, SQ, QR. There is no R Q switch, but exactly one is needed. So these burst times cannot work.
(If we run the other three sets of burst times, we get exactly one SQ, one RQ, two QR and no SP.)
Answer: P = 3, Q = 7, R = 7, S = 3
Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the scheduler has prior knowledge about the length of the CPU bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is _____________ milliseconds.
Answer: 12
Shortest job first gives the least average waiting time. Run the jobs in the order 10, 16, 20:
The waiting times are 0, 10 and 26 so the average = 36 / 3 = 12 ms.
Answer: 12
The waiting times are 0, 10 and 26 so the average = 36 / 3 = 12 ms.
Answer: 12
Which of the following statement(s) is/are correct in the context of CPU scheduling?
One or more options are correct.
Answer: (A), (C), (D)
- (A) Turnaround time is completion time arrival time. This includes the time spent waiting in the ready queue, the CPU burst and any I/O. TRUE.
- (B) The aim is to maximize CPU utilization and throughput, not to minimize throughput. FALSE.
- (C) Round-robin needs only a time quantum, not the burst lengths. TRUE.
- (D) Preemption needs a hardware timer interrupt to take the CPU back from a running process. TRUE.
Answer: (A), (C), (D)
- (B) The aim is to maximize CPU utilization and throughput, not to minimize throughput. FALSE.
- (C) Round-robin needs only a time quantum, not the burst lengths. TRUE.
- (D) Preemption needs a hardware timer interrupt to take the CPU back from a running process. TRUE.
Answer: (A), (C), (D)
Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order .
If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is _______
If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is _______
Answer: 5.25
SJF (order of running: P3 2, P4 4, P2 7, P1 8): the completion times are 2, 6, 13, 21 so the average TAT = 42 / 4 = 10.5
RR, q = 4: P1 runs 0-4, P2 runs 4-8, P3 runs 8-10 (done), P4 runs 10-14 (done), P1 runs 14-18 (done), P2 runs 18-21 (done)
Turnaround times: P1 18, P2 21, P3 10, P4 14 so the average = 63 / 4 = 15.75
Difference: |15.75 10.5| = 5.25
Answer: 5.25
RR, q = 4: P1 runs 0-4, P2 runs 4-8, P3 runs 8-10 (done), P4 runs 10-14 (done), P1 runs 14-18 (done), P2 runs 18-21 (done)
Turnaround times: P1 18, P2 21, P3 10, P4 14 so the average = 63 / 4 = 15.75
Difference: |15.75 10.5| = 5.25
Answer: 5.25
Keep practising
Topics in Operating System
System CallProcessThreadProcess SynchronizationDeadlock
CPU SchedulingYou are here
Disk SchedulingMemory ManagementFile Systems