OPERATING SYSTEMS/Student Engineering Notebook
Page 07·notes
CPU SCHEDULING ALGORITHMS—~20 MIN READ·GATE CS LENS

Scheduling Metrics & Criteria: Arrival, Burst, Turnaround & Waiting

“The golden formulas every systems engineer and GATE aspirant must master.”

1.The Scheduling Problem & Core Terminology

Whenever the CPU becomes idle, the operating system's Short-Term Scheduler must select one process from the Ready Queue to execute. How does the OS evaluate whether a scheduling algorithm is 'good'?

To measure scheduler efficiency, systems engineers rely on mathematically precise time metrics for every process Pᵢ:

Arrival Time (AT): The precise time instant at which the process enters the Ready Queue.

Burst Time (BT): The total amount of CPU execution time required by the process to complete its current CPU burst.

Completion Time (CT): The time instant at which the process finishes executing its final instruction.

Turnaround Time (TAT): The entire lifespan of the process in the system, from arrival to completion (TAT = CT - AT).

Waiting Time (WT): The total time the process spent sitting idly in the Ready Queue waiting to be allocated the CPU (WT = TAT - BT).

Response Time (RT): The time elapsed from arrival until the process produces its first response / gets its very first CPU burst.

WORKED NUMERICAL · STUDENT DERIVATION✎ Key Takeaway: In GATE problems, always calculate CT first from the Gantt chart, then derive TAT = CT - AT, then derive WT = TAT - BT. This eliminates calculation mistakes.

2. The Golden Mathematical Formulas & Derivations

Problem Statement:
Derive the relationship between Completion Time, Arrival Time, Burst Time, and Waiting Time for non-preemptive processes with no I/O.
Arrival TimeATBurst TimeBTCompletion TimeCT
Step 1: Turnaround Time Formula

Turnaround time represents total elapsed residence time in the system from arrival to completion.

TAT = CT - AT
↳ Result: Measures total system residence time.
Step 2: Waiting Time Formula

Of the total time spent in the system (TAT), the process was actively executing for its Burst Time (BT). Everything else was spent waiting in the ready queue.

WT = TAT - BT
↳ Result: WT = (CT - AT) - BT
Step 3: Average Metrics

To evaluate overall scheduling fairness, compute the arithmetic mean over all N processes.

Avg WT = (1/N) * sum(WT_i), Avg TAT = (1/N) * sum(TAT_i)
Final Answer:TAT = CT - AT and WT = TAT - BT.
GATE LENS · EXAM PREPARATION

3. GATE Lens & Verified PYQs

Syllabus focus, recurring numerical patterns, common traps, and clearly labelled exam practice. Questions remain source-pending until an official paper and answer key are attached.

EXAM WEIGHTAGE & FOCUS:

Scheduling metrics are a recurring GATE calculation area (2-4 Marks consistently) across virtually all exam papers.

recurring exam patterns:
  • •Given a table of processes with Arrival and Burst times, construct the Gantt chart and compute Average Waiting Time or Average Turnaround Time.
⚠ common student traps:
  • •Watch out for non-zero arrival times! If a process arrives at t = 2, its waiting time does NOT start counting from t = 0.
  • •If the CPU sits idle between bursts, that idle slot MUST be drawn in the Gantt chart and accounted for in CT.

Exam Practice / Source Verification Required

1 problem
GATE-style question · 2 MarksTAT = CT - AT. Avg TAT = sum(TAT) / N.

Consider three processes P1, P2, and P3 with arrival times 0, 2, and 4 ms, and CPU burst times 4, 3, and 1 ms, respectively. If non-preemptive Shortest Job First (SJF) scheduling is used, what is the average turnaround time (in ms)?

A. 3.67 ms
B. 4.33 ms
C. 5.00 ms
D. 5.67 ms
RAPID REVIEW · NOTEBOOK SUMMARY

4. 1-Minute Panic Revision

core principle:

“Always build Gantt chart → Find Completion Time (CT) → TAT = CT - AT → WT = TAT - BT.”

must-remember principles:
  • •TAT = CT - AT (Total time in system)
  • •WT = TAT - BT (Time spent waiting in ready queue)
  • •Response Time (RT) = First time getting CPU - AT
critical exam pitfalls:
  • •Never subtract AT from BT directly; WT is derived from TAT!
  • •Account for CPU idle gaps in the Gantt chart if no process has arrived.
decision flow & invariants:
[ CPU SCHEDULING DERIVATION PIPELINE ] GANTT CHART TIMELINE ┌───────────┬───────────────┬───────────────┐ │ P1 │ IDLE │ P2 │ 0 4 5 8 ▲ ▲ ▲ P1 finishes Idle gap P2 finishes (CT_1 = 4) (CT_2 = 8) STEP 1: Read Completion Time (CT) directly off Gantt right-edge. STEP 2: Turnaround Time (TAT) = CT - AT STEP 3: Waiting Time (WT) = TAT - BT STEP 4: Response Time (RT) = (First CPU allocation time) - AT
SOURCE TRANSPARENCY & CITATIONS

Primary Academic References & Exam Sources

Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.

Primary Academic Texts
Operating System Concepts (10th Edition)↗by Silberschatz, Galvin, Gagne · Chapter 5: CPU Scheduling (Section 5.2: Scheduling Criteria & Metrics)

Official Chapter 5 slides defining CPU utilization, throughput, turnaround time, waiting time, and response time.

ACADEMIC STANDARD
Operating Systems: Three Easy Pieces (OSTEP)↗by Remzi H. Arpaci-Dusseau & Andrea C. Arpaci-Dusseau · Chapter 7: Scheduling: Introduction (Workload Assumptions & Metrics)

Full chapter PDF introducing turnaround time vs response time metrics and basic scheduling policies.

ACADEMIC STANDARD
ALTERNATIVE PEDAGOGICAL PERSPECTIVES

If the textbook derivation did not click immediately, consult these targeted video lessons:

CPU Scheduling Criteria in Operating SystemGate Smashers (Varun Singla) (11 mins)

Clear breakdown of Arrival Time, Burst Time, Completion Time, TAT, WT, and CPU idle gap handling on Gantt charts.

Watch Lesson↗
Introduction to CPU Scheduling CriteriaNeso Academy (13 mins)

Whiteboard explanations comparing throughput, CPU utilization, turnaround time, and waiting time definitions.

Watch Lesson↗
RECOMMENDED YOUTUBE LECTURES & EDUCATORS: MODULE 3: CPU SCHEDULING ALGORITHMS

Curated lectures on Gantt Charts, Preemption, FCFS Convoy Effect, Round Robin Quantum & SJF/SRTF:

Gate Smashers · L-2.3: First Come First Serve (FCFS) CPU Scheduling↗Instructor: Varun Singla · Covers: FCFS with Arrival Times, Convoy Effect illustration, Turnaround Time and Waiting Time

Step-by-step Gantt chart calculations with zero arithmetic ambiguity.

Open YouTube↗
Gate Smashers · L-2.7: Round Robin (RR) Scheduling Algorithm with Example↗Instructor: Varun Singla · Covers: Preemptive Ready Queue queue management, Time Quantum tuning, Context Switch overhead

The most reliable demonstration of ready-queue tracking during simultaneous arrivals.

Open YouTube↗
Neso Academy · CPU Scheduling Criteria & Algorithms Playlist↗Instructor: Neso Academy · Covers: SJF vs SRTF preemption tie-breakers, Priority Scheduling with Aging, Multi-Level Feedback Queues

Structured textbook-level coverage with cleanly paced whiteboard walkthroughs.

Open YouTube↗
Knowledge Gate · CPU Scheduling GATE PYQs & Edge Cases↗Instructor: Sanchit Jain · Covers: GATE tricky problems with I/O burst interleaving, non-zero arrival times, priority ties

Intense numerical speed practice and identifying examiner traps in Gantt charts.

Open YouTube↗