round-robin scheduling
/ RR /
Picture a group passing a single talking-stick around a circle: each person gets to speak for a fixed short time, then must hand it on, so everyone keeps getting regular turns and no one monopolizes the conversation. Round-robin scheduling is this for the CPU — designed for time-sharing, it gives each ready process a fixed small slice of CPU time in turn, cycling through them all again and again.
How it works: the ready queue is treated as a circular FIFO. The scheduler gives the process at the head the CPU for at most one time quantum (a fixed interval, say 10 to 100 ms). If the process finishes or blocks before the quantum ends, the next process runs immediately. If the quantum expires first, a timer interrupt preempts the process, it goes to the back of the queue, and the next one runs. So with n ready processes and a quantum of q, no process waits more than (n - 1) times q before its next turn — that bound is what makes responses snappy.
Why it matters and its trade-off: round-robin is the workhorse of interactive time-sharing because it shares the CPU fairly and gives every process a quick, predictable response time. Its behavior hinges entirely on the quantum size. If q is too large, round-robin degenerates into first-come-first-served and the convoy effect returns. If q is too small, the CPU spends a large fraction of its time on context switches rather than work — overhead thrashing. The art is choosing a quantum large compared to the dispatch cost but small enough to feel responsive.
Three jobs P1, P2, P3 each needing 6 ms, quantum 2 ms. The CPU cycles P1, P2, P3, P1, P2, P3, P1, P2, P3. Each gets a turn every 6 ms, so all three make steady progress and respond quickly — none waits for a long job to finish, unlike FCFS.
Round-robin cycles fixed slices among all ready jobs — fair turns, quick response, at the cost of more switches.
Round-robin tends to give worse average turnaround time than SJF; its win is RESPONSE time and fairness, not raw efficiency. The right quantum is large relative to switch overhead but small relative to a typical CPU burst.