Chapter 8 · Simulation

Round-Robin Scheduler

← Chapter 8

Ready queue

FRONT REAR

Running process

CPU idle
—
Ready.

Round-Robin Scheduler

A CPU scheduler built on a FIFO ready queue. The process at the FRONT runs for at most one quantum (time slice). If it still needs CPU time, it is enqueued again at the REAR; otherwise it finishes.

How to use it

  • Enter a Burst (the total CPU time the process needs, 1–20) and press Add Process, or use Add Random. The simulator holds at most 6 processes.
  • Quantum (1–10) is the length of one time slice.
  • Run One Quantum executes a single slice; Run to End keeps going until every process has finished; Pause stops it; Reset empties the queue.
  • Load Example loads a ready-made workload.

Reading the display

  • Ready queue: the processes waiting for the CPU, front on the left and rear on the right.
  • Running process: the process on the CPU, its remaining time and a progress bar.
  • The bottom row shows the current operation, the clock, how many processes are ready and done, and the quantum.

Notes

  • Every process gets the CPU at regular intervals, so none starves: the wait between two turns is at most (number of processes − 1) × quantum.
  • A large quantum makes round robin behave like FCFS; a very small one causes a great many context switches.
  • After a pause, the resumed process runs only for what is left of its quantum.
  • Every dequeue and enqueue is O(1).