3.1 Scheduling Criteria & Metrics
CPU utilisation, throughput, turnaround time (completion - arrival), waiting time (turnaround - burst), response time (first response - arrival). How to calculate each from a Gantt chart. Trade-offs: minimising waiting time vs maximising throughput vs fairness. Preemptive vs non-preemptive scheduling.
3.2 FCFS, SJF & SRTF
FCFS (First Come First Served): simple, convoy effect (short jobs wait behind long ones). SJF (Shortest Job First): optimal for average waiting time (non-preemptive). SRTF (Shortest Remaining Time First): preemptive SJF. Worked numerical examples with Gantt charts for each. Starvation in SJF/SRTF.
3.3 Round Robin & Time Quantum
Each process gets a fixed time slice (quantum). After quantum expires, process goes to end of ready queue. Effect of quantum size: too large → degrades to FCFS, too small → too many context switches. Optimal quantum: 10–100ms typically. Numerical: calculate WT, TAT for given quantum. The fairest scheduling algorithm.
3.4 Priority Scheduling & Priority Inversion
Each process has a priority. Higher priority runs first. Preemptive vs non-preemptive priority. Starvation problem: low-priority processes never run. Solution: aging (gradually increase priority of waiting processes). Priority inversion: low-priority process holds a lock needed by high-priority process. Mars Pathfinder bug — the real-world priority inversion case.
3.5 Multilevel Queue & MLFQ
Multilevel Queue: separate queues for different process types (foreground/background), each with its own algorithm. Multilevel Feedback Queue (MLFQ): processes can move between queues based on behaviour — interactive processes stay in high-priority queue, CPU-bound processes move down. How Linux CFS (Completely Fair Scheduler) works conceptually.
3.6 Scheduling Numerical Practice
Given arrival times and burst times, draw Gantt chart, calculate waiting time, turnaround time, and average for: FCFS, SJF, SRTF, Round Robin, Priority. Compare algorithms on the same input. "Which algorithm gives minimum average waiting time?" — the standard exam/interview numerical question.
Placement relevance: CPU scheduling numericals appear in EVERY placement test that includes OS — TCS NQT, Infosys, Wipro, GATE, and product company written rounds. "Calculate average waiting time using Round Robin with quantum=3" is the single most asked OS numerical question. Drawing Gantt charts and computing metrics must be practised until automatic.