What is Round Robin scheduling?

Why Interviewers Ask This

This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Operating Systems topics. It also reveals how well you can explain technical ideas to non-experts.

Answer

Round Robin (RR) is a preemptive CPU scheduling algorithm designed for time-sharing systems. Each process gets a fixed time slice (quantum/time slot) of CPU time; when it expires, the process is preempted and moved to the back of the ready queue. Algorithm: maintain a circular FIFO queue of processes. Give each process Q time units (quantum). If the process finishes within Q, release CPU voluntarily. If not, preempt and add to rear of queue. Repeat. Example (Q=4ms): P1(24), P2(3), P3(3). |P1(0-4)|P2(4-7)|P3(7-10)|P1(10-14)|P1(14-18)|P1(18-22)|P1(22-26)|P1(26-28)| Wait: P1=6, P2=4, P3=7. Avg=5.67ms. Turnaround: P1=28, P2=7, P3=10. Choice of quantum: if Q is very large → degenerates to FCFS; if Q is very small → high context-switch overhead; Q should be large relative to context-switch time (typical: 10-100ms). Rule: 80% of CPU bursts should be shorter than Q. Characteristics: preemptive; fair — every process gets CPU regularly; good response time for short processes; higher average turnaround than SJF; starvation-free; context switches add overhead; more complex than FCFS. Used in: virtually all modern OSes use variants. Linux's CFS uses a virtual time-based variant. Java green threads used Round Robin. Advantage: ideal for time-sharing — users get responses quickly even with many processes.

Pro Tip

This topic has Operating Systems-specific nuances that differ from general programming. Highlighting those nuances in your answer shows expertise rather than generic knowledge.