LearnFrenzy
Sign in Take a free test

Operating Systems · Topic 3 of 11

CPU Scheduling Algorithms: questions with answers

FCFS, SJF, SRTF, Round Robin, Priority, HRRN and multilevel queues on drawn Gantt charts – waiting, turnaround and response time, context switches, burst prediction and real-time scheduling.

Questions
45
Timed sets
3
Answers run or computed
30
Your accuracy
–

What this topic covers

11 subtopics
  • Round Robin11
  • Basics6
  • FCFS5
  • Priority5
  • SRTF5
  • SJF4
  • HRRN2
  • Multilevel queues2
  • Other algorithms2
  • Real-time2
  • Real systems1
  • Beginner 15
  • Intermediate 15
  • Advanced 15

About this topic

Scheduling numericals are the most common OS questions in GATE and placement tests: draw the Gantt chart, then read off completion, turnaround (CT − AT), waiting (TAT − BT) and response times. Each question here shows the process table and, where useful, the Gantt chart; every answer was computed by a scheduling simulator. Conventions: ties go to the process listed first, a lower priority number means higher priority, and in Round Robin a process that arrives as a quantum ends joins the queue before the preempted process.

Free preview

Sample questions

Try each one first, then open the answer for the explanation and why the other options are wrong.

Question 1 SJF Beginner Practice Answer computed

All processes arrive at time 0. What is the average waiting time under non-preemptive SJF?

Processes
ProcessArrivalBurst
P106
P208
P307
P403

The answer is a number – work it out, then open the solution.

Show answer and explanation
Correct answer 7

Explanation

Shortest first: P4 0–3, P1 3–9, P3 9–16, P2 16–24. Waiting 3, 16, 9 and 0 → 28 / 4 = 7.

Question 2 SRTF Intermediate Practice Answer computed

Which Gantt chart does SRTF (preemptive SJF) produce?

Processes
ProcessArrivalBurst
P108
P214
P329
P435
Show answer and explanation
Correct answer B

Explanation

At 1, P2 (4) beats P1's remaining 7, so P1 is preempted. At 5 the ready processes have remaining 7 (P1), 9 (P3) and 5 (P4): P4 runs. Then P1 (7) before P3 (9).

Why the other options are wrong

  • AAt 5, P4 (5) is shorter than P1 (7).
  • CThat is non-preemptive SJF.
  • DP1 (7) is shorter than P3 (9).
Question 3 SRTF Advanced Practice Answer computed

SRTF scheduling. What is the average turnaround time?

Processes
ProcessArrivalBurst
P1012
P224
P336
P485

The answer is a number – work it out, then open the solution.

Show answer and explanation
Correct answer 12.25

Explanation

Gantt: P1 0–2, P2 2–6, P3 6–12 (at 8 P3 has 4 left, less than P4's 5), P4 12–17, P1 17–27. TAT 27, 4, 9, 9 → 49 / 4 = 12.25.

42 more questions in the timed setsSame format as the samples, with a timer, a question palette and a full review at the end.
Start practising

Operating Systems

All 11 topics

Topics, levels and full mocks
  1. 01 OS Basics and System Calls45 questions · 3 levels
  2. 02 Processes, Threads and fork()45 questions · 3 levels
  3. 03 CPU Scheduling Algorithms45 questions · 3 levels
  4. 04 Process Synchronization and Semaphores45 questions · 3 levels
  5. 05 Deadlocks and Banker's Algorithm45 questions · 3 levels
  6. 06 Memory Management and Paging45 questions · 3 levels
  7. 07 Virtual Memory and Page Replacement45 questions · 3 levels
  8. 08 File Systems and Disk Scheduling45 questions · 3 levels
  9. 09 Threads and Concurrency in Code45 questions · 3 levels
  10. 10 Linux Commands and Shell45 questions · 3 levels
  11. 11 GATE-Style OS Questions (MSQ & NAT)45 questions · 3 levels

Search LearnFrenzy

Esc

Quick links