Round-Robin (RR) Scheduling

College Depth 67 in the knowledge graph I know this Set as goal
Unlocks 6 downstream topics
scheduling-algorithms preemptive time-sharing

Core Idea

Round-Robin scheduling allocates each process a fixed time quantum, then moves it to the back of the ready queue. It is preemptive, providing better responsiveness and interactivity than FCFS. Performance depends heavily on quantum size: too small causes excessive context switching; too large approaches FCFS behavior.

How It's Best Learned

Trace through RR scheduling with different time quanta to observe context switches and measure turnaround time and response time changes.

Explainer

From your study of CPU scheduling basics, you know that the operating system must decide which ready process gets the CPU next. First-Come, First-Served (FCFS) is simple but unfair — a long-running process can monopolize the CPU while short jobs wait. Round-Robin (RR) scheduling solves this by giving every process a fair turn: each process runs for a fixed slice of time called a time quantum (or time slice), then gets preempted and sent to the back of the ready queue, regardless of whether it has finished.

Imagine a group of students sharing one computer in a lab. Under FCFS, whoever sits down first uses it until they are done — even if they need three hours and someone else needs thirty seconds. Under Round-Robin, a timer goes off every, say, ten minutes, and the current user must get up and go to the back of the line. Everyone gets regular access, and no one waits too long for their first turn. This is why RR is the foundation of time-sharing systems — it guarantees responsiveness by ensuring every process gets CPU time at regular intervals.

The critical design choice is the quantum size. If the quantum is very small (say, 1 millisecond), every process gets a turn almost immediately — response time is excellent. But each context switch costs time: the OS must save the current process's registers, update its state, load the next process's context, and flush caches. With a tiny quantum, you spend more time switching than computing. If the quantum is very large (say, 10 seconds), context switches are rare, but the system starts behaving like FCFS — a process runs for so long that others wait excessively. The sweet spot is typically 10–100 milliseconds: long enough to amortize the context-switch overhead, short enough that users perceive the system as concurrent.

Consider a concrete example: three processes P1, P2, and P3 arrive at time 0 with burst times of 24, 3, and 3 milliseconds, and the quantum is 4ms. P1 runs for 4ms, then yields. P2 runs for 3ms and finishes (it needed less than a full quantum). P3 runs for 3ms and finishes. P1 gets the CPU back and runs its remaining 20ms in five more quanta. Under FCFS, P2 and P3 would have waited 24ms and 27ms respectively. Under RR, P2 finished at 7ms and P3 at 10ms — dramatically better response times for the short jobs, at the cost of P1 taking slightly longer overall due to context switches.

Practice Questions 5 questions

Prerequisite Chain

Counting to 10Counting to 20Understanding ZeroThe Number ZeroCounting to FiveOne-to-One CorrespondenceCombining Small Groups Within 5Addition Within 10Addition Within 20Two-Digit Addition Without RegroupingTwo-Digit Addition with RegroupingAddition Within 100Repeated Addition as MultiplicationMultiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Two-Digit by One-Digit DivisionDivision with RemaindersRemainders and Quotients in DivisionDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueReading and Writing DecimalsComparing and Ordering DecimalsAdding and Subtracting DecimalsMultiplying DecimalsDividing DecimalsDividing FractionsMixed Number ArithmeticOrder of OperationsOperators and ExpressionsArithmetic Operators and Operator PrecedenceComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationOverflow and Underflow DetectionBinary Adders: Half-Adders and Full-AddersFull Adder and Carry PropagationCarry Lookahead Adder DesignHalf Adder Circuit DesignMultiplication Circuit DesignSequential Circuit DesignRegisters and Register FilesInstruction Set Architecture (ISA)Kernel Architecture and OS StructureSystem Calls and User/Kernel ModeProcesses and the Process Control BlockProcess Creation: fork() and exec()Process Termination and Resource CleanupProcess States and State TransitionsCPU Scheduling FundamentalsRound-Robin (RR) Scheduling

Longest path: 68 steps · 243 total prerequisite topics

Prerequisites (1)

Leads To (2)