Multilevel Queue Scheduling
Multilevel Queue (MLQ) scheduling separates processes into fixed classes. This simulator uses four queues with strict priority: Q1 is highest and Q4 is lowest.
Fixed queues and two scheduling decisions
There are two decisions. First choose the highest nonempty queue. Then use that queue's policy to choose its process. Higher-priority work can interrupt a lower queue, regardless of which burst is shorter. A process retains its assigned queue.
The preset used here
| Queue | Policy | Quantum |
|---|---|---|
| Q1 | Round Robin | 2 |
| Q2 | Round Robin | 4 |
| Q3 | Round Robin | 8 |
| Q4 | FCFS | No quantum |
| Process | Arrival | Burst | Fixed queue |
|---|---|---|---|
| P1 | 0 | 4 | Q4 |
| P2 | 1 | 5 | Q3 |
| P3 | 2 | 3 | Q2 |
| P4 | 3 | 2 | Q1 |
One CPU · One burst per process · No I/O · Dispatch cost 0. Times are abstract units.
P1 begins in Q4. At 1, P2 in Q3 interrupts it. The incoming job has 5 units versus 3 left for P1: class priority outweighs shorter work.
P3 and P4 subsequently enter their higher classes. Work returns to lower queues after higher work finishes. The full CPU trace is P1 [0, 1), P2 [1, 2), P3 [2, 3), P4 [3, 5), P3 [5, 7), P2 [7, 11), P1 [11, 14).
Fixed class assignment · not the current Ready queue
At t = 1: Q3 outranks Q4. P2's 5 units take priority over P1's 3 remaining.
- P1 / Q4: [0, 1)
- P2 / Q3: [1, 2)
- P3 / Q2: [2, 3)
- P4 / Q1: [3, 5)
- P3 / Q2: [5, 7)
- P2 / Q3: [7, 11)
- P1 / Q4: [11, 14)
Calculate the result
| Process | Completion | Waiting | Turnaround | Response |
|---|---|---|---|---|
| P1 | 14 | 10 | 14 | 0 |
| P2 | 11 | 5 | 10 | 0 |
| P3 | 7 | 2 | 5 | 0 |
| P4 | 5 | 0 | 2 | 0 |
P1: turnaround = 14 − 0 = 14. Waiting = 14 − 4 = 10. First response = 0 − 0 = 0.
First response measures only the first service. Waiting also includes later periods when this process is ready but another process owns the CPU.
Mean waiting = (10 + 5 + 2 + 0) / 4 = 4.25 units. Mean response = 0 units.
Queue policy does not remove class priority
FCFS in Q4 controls ordering inside Q4. It does not prevent a higher queue from interrupting the Q4 process. In this app, interruptions preserve unused RR allowance, and the selected nonpreemptive Q4 job is resumed when its queue can run again.
A sustained supply of higher-priority work can keep lower queues waiting. Fixed classes do not adapt automatically to a process's CPU behavior. The MLFQ article introduces changing queue membership.