Chapter 11 · Simulation

Priority Scheduler Simulator

← Chapter 11
HIGH
MEDIUM
LOW

Running process

CPU idle
—
Ready.

Priority Scheduler Simulator

A multilevel queue scheduler with three FIFO queues: HIGH, MEDIUM and LOW. The CPU always takes the first process from the highest nonempty queue and runs it for one quantum; a process that has not finished goes to the back of its own queue.

Controls

  • Choose a Burst (the CPU time the process needs) and a Priority, then press Add Process, or use Add Random. The simulator holds at most 6 processes.
  • Quantum is the length of one time slice.
  • Aging is how long a process must wait before it moves up one level (0 turns aging off).
  • Run Quantum executes one slice and Run All runs to completion. Pause stops, Reset empties every queue, and Load Example loads a ready-made workload.

Notes

  • In the queue boxes, R is the remaining time and W the waiting time.
  • Without aging, a steady stream of high-priority jobs can keep LOW processes waiting forever (starvation).
  • Aging adds the elapsed time to every waiting process. When a waiting time reaches the threshold, the process moves up one level (LOW → MEDIUM → HIGH) and its waiting time starts again from 0.
  • Within a level the order is FIFO, so processes of equal priority are served round robin.
  • Since the number of levels is fixed, picking the next process and every enqueue or dequeue take O(1) time.