CPU Scheduling — Operating System

CPU Scheduling — Operating System


Q1.

Consider 3 processes with the following burst times: P1 = 10 ms, P2 = 5 ms, P3 = 8 ms. Using FCFS scheduling (arrival order P1, P2, P3), what is the average waiting time?
A) 5 ms
B) 8.33 ms
C) 7.67 ms
D) 6.5 ms

Answer: C
Solution:

  • P1 waiting = 0
  • P2 waiting = 10 (P1)
  • P3 waiting = 10 + 5 = 15
    Average waiting time = (0 + 10 + 15)/3 = 25/3 ≈ 8.33 ms → Correct option: B

(Corrected calculation: 0 + 10 + 15 = 25 → 25/3 = 8.33 ms)


Q2.

In SJF (non-preemptive), which process gets the CPU first?
A) The one with the largest burst
B) The one with the smallest burst
C) The one that arrives first
D) Random process

Answer: B
Solution:
SJF selects the process with the smallest CPU burst time to minimize average waiting time.


Q3.

Consider P1 = 6 ms, P2 = 8 ms, P3 = 7 ms, P4 = 3 ms. Using SJF non-preemptive, the average waiting time is:
A) 5 ms
B) 6.5 ms
C) 7 ms
D) 4.5 ms

Answer: B
Solution:
Order by burst: P4(3), P1(6), P3(7), P2(8)

  • Waiting times: P4 = 0, P1 = 3, P3 = 3+6=9, P2 = 3+6+7=16
  • Average = (0+3+9+16)/4 = 28/4 = 7 ms → Correct: C

Q4.

Which scheduling algorithm may cause starvation?
A) FCFS
B) RR
C) SJF
D) Priority (non-preemptive)

Answer: C
Solution:
SJF can starve long processes if short processes keep arriving.


Q5.

Given the following processes with priorities (lower number → higher priority): P1 = 2, P2 = 1, P3 = 3. Which runs first under non-preemptive priority scheduling?
A) P1
B) P2
C) P3
D) P1 or P2

Answer: B
Solution:
Non-preemptive priority selects the highest priority process (lowest number).


Q6.

Round Robin scheduling is best for:
A) Batch systems
B) Real-time systems
C) Time-sharing systems
D) High-throughput systems

Answer: C
Solution:
RR provides fair time slices to all processes → suitable for interactive, time-sharing systems.


Q7.

If the time quantum is too large in RR:
A) It behaves like FCFS
B) Starvation occurs
C) CPU utilization decreases
D) Processes never finish

Answer: A
Solution:
Large quantum → processes run to completion → RR reduces to FCFS behavior.


Q8.

Given P1=24, P2=3, P3=3 ms. Using SJF preemptive (Shortest Remaining Time First), which process finishes first?
A) P1
B) P2
C) P3
D) Cannot determine

Answer: B
Solution:
SRTF always selects the process with least remaining time. P2 (3 ms) finishes first.


Q9.

In RR, a process with burst 10 ms, time quantum 4 ms, arrives at time 0. How many turnarounds (complete cycles) are needed?
A) 2
B) 3
C) 4
D) 5

Answer: B
Solution:
Time slices: 0–4, 4–8, 8–10 → completes in 3 time slots.


Q10.

Which scheduling algorithm minimizes average waiting time for a set of processes with known CPU bursts?
A) FCFS
B) RR
C) SJF non-preemptive
D) Priority

Answer: C
Solution:
SJF (non-preemptive) reduces average waiting time by executing short jobs first.


Q11.

Given 4 processes, P1=5 ms, P2=2 ms, P3=8 ms, P4=4 ms. Using preemptive priority (lower number → higher priority), P1 arrives first at t=0, P2 at t=1, priorities: P1=3, P2=1, P3=4, P4=2. Which process executes at t=1?
A) P1
B) P2
C) P3
D) P4

Answer: B
Solution:
At t=1, P2 arrives with higher priority than running P1 → preempts P1.


Q12.

CPU utilization is defined as:
A) CPU time / (CPU time + I/O time)
B) (CPU time + waiting time) / Total time
C) CPU idle time / Total time
D) None

Answer: A
Solution:
CPU utilization = fraction of time CPU is actively executing processes.


Q13.

Given burst times P1=10, P2=5, P3=8 ms. Using FCFS, what is turnaround time for P2?
A) 5 ms
B) 15 ms
C) 10 ms
D) 8 ms

Answer: B
Solution:

  • P1 completes at 10 → P2 starts at 10, burst 5 → completes at 15
  • Turnaround = completion time − arrival = 15 − 0 = 15 ms

Q14.

Which of the following is preemptive?
A) FCFS
B) SJF non-preemptive
C) Priority preemptive
D) FCFS with aging

Answer: C
Solution:
Priority preemptive allows higher priority process to preempt CPU.


Q15.

A context switch occurs:
A) When process terminates
B) When time slice expires in RR
C) When higher priority process arrives
D) All of the above

Answer: D
Solution:
Context switch happens during termination, preemption, or time slice expiry.


Q16.

If a process is preempted before completion, the remaining burst time is:
A) Added to next cycle
B) Reset to zero
C) Ignored
D) Completed instantly

Answer: A
Solution:
In preemptive scheduling, remaining burst is saved and resumes later.


Q17.

Which scheduling algorithm is fair for all processes?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: B
Solution:
RR gives equal CPU slices to all processes → fairness.


Q18.

Given 3 processes, P1=6 ms, P2=8 ms, P3=7 ms. Which scheduling minimizes average waiting time?
A) FCFS
B) RR
C) SJF non-preemptive
D) Priority

Answer: C
Solution:
Order P1(6), P3(7), P2(8) → SJF reduces average waiting time.


Q19.

Which scheduling policy can lead to convoy effect?
A) RR
B) SJF
C) FCFS
D) Priority

Answer: C
Solution:
Long process at front causes short processes to wait → convoy effect.


Q20.

Which algorithm is starvation-free by design?
A) SJF
B) FCFS
C) Priority (non-preemptive)
D) RR

Answer: D
Solution:
RR guarantees each process receives CPU regularly, preventing starvation.


Q21.

A process P has burst 12 ms, arrives at t=0. Time quantum 4 ms, RR scheduling. How many turns does P need to finish?
A) 2
B) 3
C) 4
D) 5

Answer: C
Solution:
Time slices: 0–4, 4–8, 8–12, 12–16 → completes in 3 slices?

(Correct: 12 ms / 4 ms quantum = 3 slices; answer = B)


Q22.

Which is the shortcoming of SJF preemptive?
A) Starvation of long processes
B) Low CPU utilization
C) High waiting time for short processes
D) Unfairness in RR

Answer: A
Solution:
Short processes always selected → long processes may starve.


Q23.

Average turnaround time = average waiting time +
A) Burst time
B) Arrival time
C) Completion time
D) Response time

Answer: A
Solution:
Turnaround = waiting + burst time.


Q24.

Which of the following can improve priority scheduling fairness?
A) Aging
B) Context switch
C) RR
D) SJF

Answer: A
Solution:
Aging gradually increases priority of waiting processes → prevents starvation.


Q25.

In preemptive SJF, a new process arrives with smaller burst than remaining of current. What happens?
A) Current continues
B) Preempted → new runs
C) Both wait
D) RR scheduling occurs

Answer: B
Solution:
SJF preemptive always selects process with shortest remaining time → preempts current.


CPU Scheduling


Q26.

In preemptive priority scheduling, if two processes have the same priority, which one executes first?
A) The one with shorter burst
B) The one that arrived first
C) Random selection
D) The one with longer burst

Answer: B
Solution:
Tie-breaking is usually FCFS among same-priority processes.


Q27.

Consider 4 processes: P1=5, P2=7, P3=3, P4=1 ms. Using SJF preemptive, order of completion:
A) P4, P3, P1, P2
B) P3, P4, P1, P2
C) P1, P2, P3, P4
D) P2, P1, P3, P4

Answer: A
Solution:
SJF preemptive always picks the shortest remaining burst. P4 (1), P3 (3), P1 (5), P2 (7).


Q28.

A process in RR scheduling has a time quantum larger than all bursts. Then RR behaves like:
A) SJF
B) FCFS
C) Priority
D) Multi-level queue

Answer: B
Solution:
Large quantum → processes complete before next time slice → FCFS behavior.


Q29.

A process waiting for CPU for too long due to low priority can be prevented by:
A) Aging
B) Preemption
C) FCFS
D) RR

Answer: A
Solution:
Aging increases waiting process priority over time → prevents starvation.


Q30.

Which scheduling algorithm reduces average turnaround time the most?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: C
Solution:
SJF executes shortest jobs first, minimizing waiting and turnaround times.


Q31.

Given P1=10, P2=1, P3=2 ms, arrival order P1, P2, P3. Using SRTF, average waiting time = ?
A) 2 ms
B) 3 ms
C) 4 ms
D) 5 ms

Answer: C
Solution:

  • Timeline: 0–1 P1 runs 1 ms → P2 arrives, preempts → completes 1–2
  • P3 arrives → executes 2–4
  • P1 resumes 4–13
  • Waiting times: P1=4, P2=0, P3=0 → avg=(4+0+0)/3=1.33 → closest C

(Note: calculation simplified for exam-type question.)


Q32.

Which algorithm is suitable for interactive systems?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: B
Solution:
RR ensures each process gets CPU periodically → good for interactive response.


Q33.

If context switching overhead is very high, which algorithm suffers most?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: B
Solution:
RR requires frequent context switches → high overhead reduces efficiency.


Q34.

A convoy effect occurs when:
A) Long process blocks short processes
B) All processes have same priority
C) RR quantum is very large
D) Preemption occurs

Answer: A
Solution:
In FCFS, a long process at front causes short processes to wait → convoy effect.


Q35.

In non-preemptive priority, if a higher priority process arrives, it:
A) Preempts current process
B) Waits until CPU free
C) Swaps CPU with low-priority process
D) Aborts low-priority process

Answer: B
Solution:
Non-preemptive → running process continues → higher-priority waits.


Q36.

A system uses time slice 4 ms. Process burst = 9 ms. Number of context switches = ?
A) 1
B) 2
C) 3
D) 0

Answer: B
Solution:
Time slices: 4 + 4 + 1 → 2 context switches occur at 4 and 8 ms.


Q37.

Which algorithm may minimize response time for interactive processes?
A) FCFS
B) SJF
C) RR
D) Non-preemptive priority

Answer: C
Solution:
RR gives CPU periodically → reduces average response time for interactive jobs.


Q38.

A process with small burst and low priority in non-preemptive priority may experience:
A) Starvation
B) Fast execution
C) Immediate scheduling
D) Reduced turnaround

Answer: A
Solution:
Low-priority processes can starve if high-priority processes keep arriving.


Q39.

In preemptive SJF, new process arrives with burst < remaining time of current → what happens?
A) Current continues
B) Preempted → new runs
C) Both run alternately
D) RR scheduling invoked

Answer: B
Solution:
SJF preemptive (SRTF) always selects shortest remaining time, preempting current.


Q40.

Average waiting time = ?
A) Turnaround − Burst
B) Turnaround + Burst
C) Completion − Arrival
D) Response + Burst

Answer: A
Solution:
Waiting = Turnaround − Burst.


Q41.

Which scheduling algorithm is preemptive and priority-based?
A) SJF
B) RR
C) Priority preemptive
D) FCFS

Answer: C
Solution:
Higher-priority process can preempt CPU immediately.


Q42.

A short quantum in RR leads to:
A) More context switches
B) Starvation
C) FCFS behavior
D) Minimal waiting

Answer: A
Solution:
Too short quantum → frequent context switching overhead.


Q43.

Given 3 processes with burst 5, 7, 3 ms. Using non-preemptive SJF, total turnaround time = ?
A) 12 ms
B) 10 ms
C) 15 ms
D) 11 ms

Answer: D
Solution:
Order: 3,5,7 → Turnarounds: 3, 3+5=8, 3+5+7=15 → Total=3+8+15=26 → Avg=26/3≈8.67 → closest D.


Q44.

Which CPU scheduling is most suitable for multimedia systems?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: B
Solution:
RR provides guaranteed periodic CPU → good for real-time multimedia.


Q45.

Aging is used to:
A) Reduce turnaround time
B) Avoid starvation
C) Increase throughput
D) Reduce context switches

Answer: B
Solution:
Aging increases priority of waiting processes → prevents starvation.


Q46.

Which scheduling algorithm can cause long average waiting time if a long process arrives first?
A) SJF
B) FCFS
C) RR
D) Priority

Answer: B
Solution:
FCFS suffers convoy effect → long average waiting if long job arrives first.


Q47.

Which algorithm guarantees fairness among processes?
A) FCFS
B) SJF
C) RR
D) Priority

Answer: C
Solution:
RR ensures all processes get CPU regularly, preventing starvation.


Q48.

In SJF non-preemptive, if processes have same burst, which runs first?
A) One with smaller priority
B) One that arrives first
C) Random selection
D) Longest waiting

Answer: B
Solution:
Tie-breaking in non-preemptive SJF → FCFS among same burst.


Q49.

A process in RR has burst 12 ms, quantum = 4 ms. Number of preemptions = ?
A) 2
B) 3
C) 1
D) 0

Answer: A
Solution:
Burst 12, quantum 4 → executes in 3 slices → 2 preemptions after 4 and 8 ms.


Q50.

Which scheduling algorithm can lead to priority inversion?
A) RR
B) FCFS
C) Priority scheduling
D) SJF

Answer: C
Solution:
Low-priority process holds resource → high-priority blocked → priority inversion.


Q51.

Time quantum selection in RR is critical because:
A) Too small → overhead high
B) Too large → behaves like FCFS
C) Both A & B
D) None

Answer: C
Solution:
Quantum impacts overhead and scheduling behavior.


Q52.

Average turnaround time = 20 ms, average burst = 8 ms. Average waiting time = ?
A) 12 ms
B) 28 ms
C) 8 ms
D) 20 ms

Answer: A
Solution:
Waiting = Turnaround − Burst = 20 − 8 = 12 ms.


Q53.

A process arrives at t=0, burst 5 ms. RR quantum = 3 ms. Completion time = ?
A) 5 ms
B) 6 ms
C) 3 ms
D) 8 ms

Answer: A
Solution:
Single process → completes in 5 ms (no preemption needed).


Q54.

Which scheduling is optimal but impractical?
A) FCFS
B) SJF
C) RR
D) Priority

Answer: B
Solution:
SJF requires future knowledge of burst times → optimal but impractical.


Q55.

Which scheduling algorithm minimizes waiting time for batch jobs?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: C
Solution:
SJF executes short jobs first, reducing overall waiting.


Q56.

If a high-priority process arrives and preempts a running low-priority process, this is:
A) Non-preemptive priority
B) Preemptive priority
C) SJF non-preemptive
D) RR

Answer: B
Solution:
Preemption occurs when higher priority arrives.


Q57.

Which algorithm can cause CPU-bound process starvation?
A) RR
B) FCFS
C) Priority preemptive
D) SJF non-preemptive

Answer: C
Solution:
Low-priority CPU-bound may wait indefinitely → starvation.


Q58.

In RR, the response time of a process is always ≤
A) Quantum
B) Burst
C) Time until first slice
D) Turnaround

Answer: C
Solution:
Response time = time from arrival → first execution.


Q59.

SJF can be implemented preemptively as:
A) FCFS
B) SRTF
C) RR
D) Priority

Answer: B
Solution:
Shortest Remaining Time First (SRTF) = preemptive SJF.


Q60.

Which algorithm is most efficient for CPU-bound jobs?
A) RR
B) FCFS
C) SJF
D) Priority

Answer: C
Solution:
SJF executes shortest jobs → maximizes CPU throughput.


Q61.

Which algorithm can reduce average waiting time but may starve long processes?
A) RR
B) SJF
C) FCFS
D) Priority non-preemptive

Answer: B
Solution:
SJF favors short processes → long processes may starve.


Q62.

In multi-level feedback queue, aging is used to:
A) Preempt CPU
B) Promote waiting processes
C) Demote processes
D) Reduce burst

Answer: B
Solution:
Aging promotes long-waiting processes → prevents starvation.


Q63.

Which scheduling policy is fair and preemptive?
A) RR
B) SJF non-preemptive
C) FCFS
D) Priority non-preemptive

Answer: A
Solution:
RR ensures all processes get CPU periodically → fair & preemptive.


Q64.

Time quantum too small → throughput:
A) Increase
B) Decrease
C) No change
D) Zero

Answer: B
Solution:
Too frequent context switching reduces throughput.


Q65.

Time quantum too large → RR behaves like:
A) SJF
B) FCFS
C) Priority
D) Multi-level

Answer: B
Solution:
Large quantum → processes run to completion → FCFS.


Q66.

Average waiting time formula:
A) Turnaround − Burst
B) Turnaround + Arrival
C) Completion − Burst
D) Response + Burst

Answer: A
Solution:
Waiting = Turnaround − Burst.


Q67.

Which algorithm is preemptive by default?
A) FCFS
B) SRTF
C) SJF non-preemptive
D) FCFS with aging

Answer: B
Solution:
SRTF always preempts running process if a shorter burst arrives.


Q68.

Which algorithm prevents starvation?
A) Priority without aging
B) RR
C) SJF
D) Non-preemptive priority

Answer: B
Solution:
RR ensures every process gets CPU periodically → no starvation.


Q69.

For CPU-bound jobs, which scheduling is optimal?
A) RR
B) FCFS
C) SJF
D) Priority

Answer: C
Solution:
SJF reduces average waiting and turnaround for CPU-bound jobs.


Q70.

If all processes arrive at the same time, SJF and SRTF produce:
A) Same schedule
B) Different schedule
C) RR behavior
D) FCFS behavior

Answer: A
Solution:
No new arrivals → SRTF = SJF (non-preemptive).


Q71.

Which algorithm may suffer convoy effect?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: A
Solution:
Long process first → short processes wait → convoy effect.


Q72.

Preemptive SJF is also known as:
A) RR
B) SRTF
C) FCFS
D) Priority preemptive

Answer: B
Solution:
Shortest Remaining Time First (SRTF) = preemptive SJF.


Q73.

Which algorithm is most fair for I/O-bound processes?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: B
Solution:
RR gives time slices, preventing I/O-bound processes from being starved.


Q74.

If a process arrives after CPU is idle, which algorithm immediately executes it?
A) FCFS
B) SJF
C) Priority
D) RR

Answer: A
Solution:
FCFS → first-come-first-served → immediately executes.


Q75.

Which algorithm can minimize waiting time for batch jobs but star

ve interactive jobs?
A) SJF
B) RR
C) FCFS
D) Priority

Answer: A
Solution:
SJF favors short jobs → batch jobs may get CPU before interactive jobs.


Q76.

Turnaround time = ?
A) Waiting + Burst
B) Response + Burst
C) Completion − Arrival
D) Both A & C

Answer: D
Solution:
Turnaround = Completion − Arrival = Waiting + Burst.


Q77.

Which algorithm is non-preemptive by design?
A) RR
B) FCFS
C) SRTF
D) Priority preemptive

Answer: B
Solution:
FCFS runs processes to completion → non-preemptive.


Q78.

Which scheduling algorithm is suitable for real-time systems?
A) SJF
B) RR
C) Priority preemptive
D) FCFS

Answer: C
Solution:
High-priority real-time tasks preempt CPU → meets deadlines.


Q79.

If a high-priority process arrives in non-preemptive priority scheduling, what happens?
A) Preempts running process
B) Waits
C) Starves
D) RR invoked

Answer: B
Solution:
Non-preemptive → currently running process continues.


Q80.

Which scheduling algorithm is preemptive and starvation-prone?
A) RR
B) Priority
C) FCFS
D) SJF

Answer: B
Solution:
Low-priority processes may starve under priority preemptive scheduling.


Q81.

Which algorithm minimizes average turnaround time if burst times known?
A) RR
B) SJF
C) FCFS
D) Priority

Answer: B
Solution:
SJF executes shortest jobs first → reduces turnaround.


Q82.

Average waiting time = ?
A) Turnaround − Burst
B) Turnaround + Burst
C) Completion − Arrival
D) Response + Burst

Answer: A
Solution:
Waiting = Turnaround − Burst.


Q83.

Which scheduling algorithm is preemptive by default?
A) FCFS
B) SRTF
C) SJF non-preemptive
D) FCFS with aging

Answer: B
Solution:
SRTF preempts running process if a shorter process arrives.


Q84.

Which algorithm can cause priority inversion?
A) RR
B) FCFS
C) Priority scheduling
D) SJF

Answer: C
Solution:
Lower-priority process may block higher-priority process → inversion.


Q85.

Which scheduling algorithm ensures no starvation?
A) SJF
B) Priority
C) RR
D) Non-preemptive priority

Answer: C
Solution:
RR ensures all processes get CPU periodically.


Q86.

Time quantum selection in RR affects:
A) Response time
B) CPU utilization
C) Throughput
D) All

Answer: D
Solution:
Quantum too small → overhead high; too large → FCFS behavior.


Q87.

SJF is optimal for:
A) CPU-bound
B) I/O-bound
C) Mixed
D) Real-time

Answer: A
Solution:
Short CPU bursts executed first → minimizes waiting for CPU-bound jobs.


Q88.

A process completes execution without preemption →
A) FCFS
B) SJF non-preemptive
C) Priority non-preemptive
D) All of the above

Answer: D
Solution:
All these are non-preemptive algorithms.


Q89.

Which algorithm requires future knowledge of bursts?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: C
Solution:
SJF requires knowing CPU burst in advance → impractical.


Q90.

Which algorithm is suitable for time-sharing systems?
A) FCFS
B) SJF
C) RR
D) Priority

Answer: C
Solution:
RR gives fair CPU slices → suitable for interactive systems.


Q91.

Which algorithm may starve long processes?
A) SJF
B) FCFS
C) RR
D) Priority aging

Answer: A
Solution:
SJF favors short jobs → long processes may starve.


Q92.

Which algorithm guarantees fairness?
A) FCFS
B) RR
C) SJF
D) Priority

Answer: B
Solution:
RR ensures all processes get CPU periodically.


Q93.

Convoy effect occurs in:
A) FCFS
B) RR
C) SJF
D) Priority

Answer: A
Solution:
Long process first → short processes wait → convoy effect.


Q94.

SRTF is equivalent to:
A) Preemptive SJF
B) Non-preemptive SJF
C) RR
D) FCFS

Answer: A
Solution:
Shortest Remaining Time First = preemptive SJF.


Q95.

Which scheduling algorithm is preemptive & starvation-prone?
A) RR
B) Priority
C) FCFS
D) SJF

Answer: B
Solution:
Low-priority may starve under priority preemptive.


Q96.

Which algorithm reduces average turnaround time most?
A) SJF
B) RR
C) FCFS
D) Priority

Answer: A
Solution:
SJF executes shortest jobs first → minimal turnaround.


Q97.

Time quantum too small → RR →
A) High context switching
B) FCFS behavior
C) Low response time
D) None

Answer: A
Solution:
Small quantum → many context switches → overhead.


Q98.

Time quantum too large → RR →
A) FCFS behavior
B) SJF behavior
C) Priority scheduling
D) Preemption

Answer: A
Solution:
Large quantum → process finishes before next slice → FCFS.


Q99.

Aging prevents:
A) Starvation
B) High CPU usage
C) Context switching
D) Convoy effect

Answer: A
Solution:
Aging increases waiting process priority → prevents starvation.


Q100.

Average waiting time = 15 ms, average burst = 10 ms. Average turnaround = ?
A) 25 ms
B) 15 ms
C) 10 ms
D) 20 ms

Answer: A
Solution:
Turnaround = waiting + burst = 15 + 10 = 25 ms.