Skip to content
FoundationSource checked

Round Robin Scheduling

Gives each ready task a fixed time slice in cyclic order.

Quick Facts

Compact metadata for implementation and discovery.

Category
Scheduling
Difficulty
Beginner
Family
Preemptive Scheduling
Tier
Foundation
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
20
Code example
Ready
Visualization
Ready
Aliases
RR Scheduling

Overview

Round Robin Scheduling rotates tasks through a queue so each task gets a fair chance to run.

Core Concepts

task orderingprocess schedulingqueue frontierpreemptive schedulingready queuetask priorityresource allocation

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(n)

Average

O(n + c)

Worst

O(n + c)

Space

O(n)

When to Use

  • Use it when ready tasks should receive time slices in cyclic order.
  • Use it for simple fair sharing among similar tasks.
  • Use it when response time matters more than minimizing total completion time.

When Not to Use

  • Avoid it when tasks have strict deadlines or priorities that must dominate fairness.
  • Avoid quantum sizes that are too small relative to context-switch overhead.
  • Avoid it when workload-aware scheduling can substantially improve latency or throughput.

What It Does

  • Cycles through ready tasks
  • Limits each run to a time quantum

Use Cases

  • CPU time sharing
  • Fair task scheduling
  • Interactive systems

Inputs

  • Ready task queue
  • Time quantum

Outputs

  • Execution order
  • Completion times

Key Formulas (1)

Time slice

runtime = min(timequantum, remainingtime)
run_time = min(time_quantum, remaining_time)

Limits each ready task to the configured quantum before rotating.

Pseudocode

  1. 1.Put ready tasks in a queue
  2. 2.Run the front task for one time quantum
  3. 3.Finish it if its work is complete
  4. 4.Otherwise put it at the back of the queue
  5. 5.Repeat until all tasks finish

Canonical Example

Input
tasks A=5ms, B=3ms, quantum=2ms
Output
execution slices A, B, A, B, A
Explanation
Each unfinished task returns to the back of the queue after its time slice.

Implementation Notes

  • Keep ready tasks in a FIFO queue.
  • Run each task for at most one quantum before requeuing it if unfinished.
  • Track arrival, completion, and remaining time separately.

Common Pitfalls

  • Choosing a time quantum that causes excessive context switching.
  • Treating all tasks equally when priorities or deadlines are required.
  • Failing to remove completed tasks from the rotation.

Interactive Mechanism Walkthrough

Graph Frontier & Edge Relaxation

Show tasks rotating through a queue with fixed time slices.

Round Robin Scheduling mechanism walkthrough step 1 of 5suvwxt
Step 1 of 5: Put ready tasks in a queue
task-queue

Notes

Round robin improves fairness but does not account for task length unless combined with other policies.

Sources (1)

What each reference supports for this entry.

Operating System Concepts

Book

Operating-systems reference for Round Robin Scheduling CPU scheduling policy, ready-queue ordering, and preemption behavior.

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Alternative toShortest Job First

Round robin shares CPU time by time slices, while shortest-job-first prioritizes short bursts.

Tags

SchedulingOperating SystemsQueue