Operating Systems

Unit 3: CPU Scheduling

From FCFS to Multilevel Feedback Queues โ€” master every scheduling algorithm with fully worked numerical problems, Gantt charts, and step-by-step solutions.

โฑ๏ธ 8 hrs theory + 6 hrs lab  |  ๐Ÿ’ฐ Earning Potential: โ‚น5,000โ€“โ‚น20,000/month  |  ๐Ÿ“ 30 MCQs (Bloom's Mapped)

๐Ÿ’ผ Jobs this unlocks: Performance Engineer (โ‚น6โ€“10 LPA)  |  SRE โ€” Site Reliability Engineer (โ‚น8โ€“15 LPA)  |  Systems Programmer (โ‚น7โ€“12 LPA)

Section A

Opening Hook โ€” The 60-Second Window That Breaks India's Internet

๐Ÿš‚ IRCTC Tatkal Booking โ€” 12 Lakh Users, 60 Seconds Each

Every morning at 10:00 AM sharp, over 12 lakh (1.2 million) users simultaneously hit the IRCTC servers trying to book Tatkal tickets. Each user gets roughly a 60-second window before their session times out. The server must decide: Who gets CPU time first? How long? What if someone's request is more urgent?

This is CPU scheduling in action. IRCTC uses a variant of Round Robin scheduling โ€” each user request gets a fixed time quantum, ensuring no single request hogs the server. Priority queues ensure Tatkal requests (higher revenue) get processed before general waitlist queries.

The result? On a good day, 15,000 tickets are booked per minute. On a bad day? The entire system crashes because the scheduler couldn't handle the load. The difference between success and failure is the scheduling algorithm.

Could YOU have designed a better scheduler? By the end of this chapter, you'll know exactly how โ€” and you'll be able to prove it with numbers.

๐Ÿ‡ฎ๐Ÿ‡ณ IRCTC๐Ÿ‡ฎ๐Ÿ‡ณ Zerodha๐Ÿ‡ฎ๐Ÿ‡ณ FlipkartGoogleLinux KernelMicrosoft Windows
The Linux kernel's CFS (Completely Fair Scheduler) handles CPU scheduling for 96.3% of the world's top 500 supercomputers, every Android phone, and most cloud servers. It was written by Ingo Molnรกr in 2007 and uses a red-black tree to guarantee O(log n) scheduling decisions. You're learning the foundations of the same algorithms today.
Section B

Learning Outcomes โ€” Bloom's Taxonomy Mapped

Bloom's LevelLearning Outcome
๐Ÿ”ต RememberDefine scheduling criteria (CPU utilization, throughput, turnaround time, waiting time, response time) and list all 7 scheduling algorithms
๐Ÿ”ต UnderstandExplain the difference between preemptive and non-preemptive scheduling, and describe the convoy effect, starvation, and aging
๐ŸŸข ApplySolve numerical problems for FCFS, SJF, SRTF, Priority, and Round Robin โ€” compute Gantt charts, waiting time, and turnaround time
๐ŸŸข AnalyzeCompare scheduling algorithms on the basis of average waiting time, throughput, and fairness using computed results
๐ŸŸ  EvaluateEvaluate which scheduling algorithm is optimal for given real-world scenarios (e.g., IRCTC, trading systems, batch processing)
๐ŸŸ  CreateDesign a multilevel feedback queue scheduling policy for a given workload mix and implement a CPU scheduler simulator in Python