Multilevel Queue and Multilevel Feedback Queue
Multilevel Queue and Multilevel Feedback Queue
Key Concepts:
• Multiple queues are maintained (e.g., foreground, background).
• Each queue can use a different scheduling method (e.g., foreground processes could
use Round Robin; background processes could use FCFS — First-Come, First-Served).
• No movement between queues (in traditional Multilevel Queue scheduling — unlike
in Multilevel Feedback Queue).
• Designed mainly for systems with different types of processes needing different
scheduling treatment.
Working Example:
Suppose we have 3 queues:
1. System processes (Highest priority)
2. Interactive processes (Medium priority)
3. Background jobs (Lowest priority)
• If any System process is available, it will run first.
• Interactive processes will only get the CPU when no system process is in the queue.
• Background jobs run only if both system and interactive queues are empty.
Advantages:
• Easy to design and implement.
• Good for systems where different types of processes need different handling (e.g.,
real-time vs batch jobs).
Disadvantages:
• Rigid: A process stuck in a lower-priority queue may face starvation (may never get
CPU time if high-priority queues are always full).
• No flexibility for processes to "move up" if their behavior changes (this is improved in
Multilevel Feedback Queues).
Key Properties:
• Multiple Queues ordered by priority.
• Each queue may have a different scheduling algorithm (e.g., Round Robin, FCFS).
• Process movement:
o If a process uses too much CPU time, it is moved to a lower-priority queue.
o If a process waits too long, it may be promoted to a higher-priority queue (to
prevent starvation).
How it Works:
• When a process enters the system, it starts in the highest priority queue.
• If it uses too much CPU time (doesn't finish quickly), it is moved down.
• If it finishes quickly, it stays at higher priority.
• The CPU always selects processes from the highest non-empty queue.
Advantages:
• Dynamic and Flexible.
• Good for interactive systems (like operating systems).
• Short processes get fast response (higher queues).
Disadvantages:
• Complex to implement.
• Need to tune time quanta carefully.
• Risk of starvation for long processes unless aging is used.
Quick Summary:
Multilevel Queue Multilevel Feedback Queue
Fixed queues, no movement Process can move between queues
Example
Multilevel Queue Scheduling (Fixed Queues — NO movement)
P2 1 ms 20 ms
P3 2 ms 25 ms
Assumption:
Scheduling Flow:
• Time 0: P1 arrives → High Priority Queue → Runs first.
• P1 needs 6 ms → completes at time 6.
• Time 1: P2 arrives → Goes to Queue 2 (Interactive).
• Time 2: P3 arrives → Goes to Queue 3 (Background).
Now:
• P1 done → CPU checks next: Queue 2 (Interactive, P2).
• P2 runs Round Robin (Quantum = 8 ms).
1. P2 runs from 6 ms → 14 ms (8 ms used).
2. P2 still has (20-8)=12 ms left.
3. In Round Robin, it can continue or rotate if others exist — since no other
interactive process, P2 continues.
• P2 runs next 8 ms from 14 → 22 ms.
o Now, P2 has 4 ms remaining.
• P2 runs 4 ms from 22 → 26 ms → Finishes.
• Now, CPU checks Queue 3.
• P3 (Background) runs from 26 → (26+25) = 51 ms → Finishes.
P2 1 ms 20 ms
P3 2 ms 25 ms
Assumption: