Move beyond memorising algorithm names. Build schedules, inspect every decision, calculate each metric and explain which policy fits an interactive, batch or priority-sensitive workload.
Level 05 of 15Intermediate100–130 minutesInteractive simulator
BY THE END, YOU CAN
Build and defend a schedule
Separate scheduler policy from dispatcher mechanism.
Calculate CT, TAT, WT and RT correctly.
Trace preemptive and non-preemptive algorithms.
Explain convoy effect, starvation, aging and quantum trade-offs.
Select a policy using workload goals.
01 • SPEAK THE SCHEDULER'S LANGUAGE
Policy Chooses; the Dispatcher Performs the Switch
When several processes are ready, the short-term scheduler selects one. The dispatcher transfers control by switching context, entering user mode and jumping to the selected instruction.
1
Ready queue
Runnable processes wait for CPU service.
2
Scheduler
A policy selects the next process.
3
Dispatcher
Context is switched and control transferred.
4
Running
The process executes until an event or decision point.
NON-PREEMPTIVE
Keep the CPU until release
The running process continues until it terminates or blocks. Decisions are simpler, but a long burst can delay urgent short work.
PREEMPTIVE
The OS may take the CPU back
A timer, new arrival or priority change may trigger a new choice. Responsiveness improves, with extra context-switch and coordination cost.
02 • MEASURE THE RESULT
One Schedule Can Be Good by One Metric and Poor by Another
CT
Completion time
Clock time when the process finishes.
CT = finish timeTAT
Turnaround time
Total time from arrival to completion.
TAT = CT − ATWT
Waiting time
Time spent ready but not executing.
WT = TAT − BTRT
Response time
Delay until the process first gets CPU.
RT = first start − AT
CPU utilisation keep useful work runningThroughput finish more jobsTurnaround finish jobs soonerResponse react quicklyFairness prevent indefinite delay
03 • COMPARE THE POLICIES
Every Algorithm Encodes a Different Promise
FCFS
Arrival order
Non-preemptive and simple. A long job at the front creates the convoy effect.
Risk: poor response for short arrivalsSJF
Shortest next burst
Non-preemptive. Minimises average waiting for known bursts, but estimates can be wrong.
Risk: long-job starvationSRTF
Shortest remaining work
Preemptive SJF. A newly arrived shorter job can replace the current one.
Risk: switching and starvationPRIORITY
Importance first
Run the best priority value; this lesson uses a smaller number as higher priority.
Fix starvation with agingROUND ROBIN
Bounded time slices
Rotate the ready queue after one quantum. It favours responsiveness and sharing.
Quantum controls the trade-off
04 • INTERACTIVE GANTT LAB
Change the Workload and Recalculate Everything
Select a preset or edit the process table. The simulator builds the actual execution timeline, including idle spans and preemptions.
Process
Arrival (AT)
Burst (BT)
Priority
FCFS
First Come, First Served
P1P2P3P4Idle
Process
AT
BT
First CPU
CT
TAT
WT
RT
05 • MATCH POLICY TO PURPOSE
Diagnose the Workload before Naming an Algorithm
Choose the most important goal. The explanation highlights a sensible starting policy and the trade-off you must still defend.
06 • CALCULATE WITHOUT GUESSING
A Reliable Exam Method
1
Draw arrivals
Do not schedule a process before its arrival time.
2
Apply one decision rule
Resolve ties consistently, usually by arrival then process order.
3
Record first and final times
Preemptive jobs may have many spans but only one first start and completion.
4
Calculate in dependency order
Find CT, then TAT, then WT; find RT from first start.
Solved FCFS example
For P1(AT 0, BT 4), P2(AT 1, BT 3), P3(AT 2, BT 1), FCFS gives P1: 0–4, P2: 4–7, P3: 7–8. Completion times are 4, 7 and 8. Turnaround times are 4, 6 and 6. Waiting times are 0, 3 and 5. Because FCFS is non-preemptive, each response time equals its waiting time.
Solved Round Robin insight
With all jobs ready and quantum 2, each unfinished process receives at most two time units before moving behind other ready processes. A smaller quantum can improve early response, but too small a quantum spends excessive time switching rather than doing useful work.
07 • CHECK YOUR UNDERSTANDING
Ten Misconception-Specific Checks
Each option explains the exact reasoning behind it.
Answered correctly: 0 of 10
08 • EXPLAIN & PREPARE
University and Placement Questions
2-MARK QUESTIONS
Define CPU scheduling.
What is response time?
Define preemption.
What is the convoy effect?
What is aging?
5-MARK QUESTIONS
Compare FCFS and Round Robin.
Calculate SJF metrics for four jobs.
Explain SRTF with a Gantt chart.
Discuss priority starvation and aging.
Explain quantum selection.
INTERVIEW QUESTIONS
Why is SJF theoretically attractive but difficult?
Can waiting time exceed turnaround time?
When does RR behave like FCFS?
Does preemption always improve performance?
How would you schedule interactive and batch work together?
Show a strong answer: “Compare FCFS and Round Robin”
Classify FCFS as non-preemptive and RR as preemptive.
Explain queue order and the RR quantum.
Compare responsiveness, overhead and fairness.
Mention FCFS convoy effect and RR quantum sensitivity.