WIPIVERSE All articles

Multilevel feedback queue

The multilevel feedback queue (MLFQ) is a CPU scheduling algorithm used by operating systems to manage process execution. It combines multiple priority queues, each with its own scheduling policy, and allows processes to move between queues based on their observed behavior, chiefly their CPU burst characteristics.

Key characteristics

Aspect Description
Structure A set of at least two priority queues, typically arranged from highest to lowest priority.
Scheduling within queues Each queue can employ a distinct algorithm (commonly round‑robin with a time quantum, or first‑come, first‑served).
Feedback mechanism Processes are promoted or demoted among queues based on runtime metrics such as CPU burst length, I/O activity, or whether they exhaust their time quantum.
Goal To favor interactive and I/O‑bound processes (which typically have short CPU bursts) while still guaranteeing eventual service for CPU‑bound processes.
Preemption Higher‑priority queues preempt lower‑priority ones; a process may be preempted when a higher‑priority process becomes ready.
Aging Some implementations incorporate aging to prevent starvation of low‑priority processes, gradually increasing their priority over time.

Typical operation

  1. Arrival – A newly created process enters the highest‑priority queue.
  2. Execution – The scheduler selects the first process from the highest non‑empty queue and runs it for a time slice (quantum) appropriate to that queue.
  3. Quantum expiration – If the process does not block (e.g., for I/O) before the quantum expires, it is moved to the next lower‑priority queue.
  4. I/O or blocking – If the process blocks before the quantum expires, it remains in its current queue (or may be promoted) when it becomes ready again.
  5. Completion – When a process finishes, it is removed from the system.

Advantages

  • Provides a balance between responsiveness for short, interactive jobs and fairness for long, CPU‑intensive jobs.
  • Adaptable: time quantum and number of queues can be tuned to specific workloads.
  • Supports dynamic priority adjustment without requiring explicit priority assignment by the programmer.

Disadvantages

  • Requires careful selection of queue parameters; poor choices can lead to suboptimal performance or increased overhead.
  • More complex than single‑queue algorithms, leading to higher implementation and maintenance costs.
  • May still suffer from starvation of low‑priority processes if aging is not employed.

Historical context

The concept traces back to early research on multiprogramming and time‑sharing systems in the 1960s and 1970s. It was formally described in academic literature such as D. E. Bell’s “The Scheduling of Processes” (1971) and later incorporated into many textbook treatments of operating‑system design. Commercial operating systems, notably early versions of UNIX and later OS kernels (e.g., Linux’s O(1) scheduler, which incorporated MLFQ‑like ideas before being replaced by the Completely Fair Scheduler), have employed variants of the algorithm.

Variants and related algorithms

  • Two‑level feedback queue – A simplified version with only two priority levels.
  • Multilevel queue with feedback – A hybrid where some queues allow feedback while others have static priorities.
  • Dynamic quantum adjustment – Some implementations vary the time slice per queue based on system load.

Practical usage

While modern mainstream operating systems often use more sophisticated schedulers (e.g., Linux’s Completely Fair Scheduler, Windows’ Multilevel Feedback Queue Scheduler with additional heuristics), the MLFQ model remains a foundational teaching tool and a basis for specialized real‑time or embedded system schedulers where deterministic behavior and priority control are essential.

Browse

More topics to explore

    Browse all articles