Multilevel Queue Scheduling
Multilevel queue scheduling is used when processes in the ready queue can be divided into different classes where each class has its own scheduling needs.
For instance, foreground or interactive processes and background or batch processes are commonly divided. Foreground and background processes have different time requirements and hence will have different scheduling needs. In this case, multilevel queue scheduling will be used.
Working:
For each class of processes, the ready queue is divided into separate queues.
For example, there are five processes:
- System Processes
- Interactive Processes
- Interactive Editing Processes
- Batch Processes
- Student Process
Every queue will have an absolute priority over low priority queues. No process can run until the high priority queues are empty. For the above example, until and unless the queues for system processes, interactive processes, and interactive editing processes are all empty, no other process can run.
Advantages:
Multilevel Queue Scheduling has some advantages like:
- Multilevel queue scheduling helps us apply different scheduling algorithms for different processes.
- It will have a low scheduling overhead.
Disadvantages:
Some of the disadvantages of Multilevel queue scheduling are as follows:
- There are chances of starving for the lower priority processes.
- It is inflexible in nature.
Example of Multilevel queue scheduling:
Let us consider the following 4 processes:
Process | Burst time | Arrival time | Queue number |
P1 | 4 | 0 | 1 |
P2 | 3 | 0 | 1 |
P3 | 8 | 0 | 2 |
P4 | 5 | 10 | 1 |
The Gantt Chart will be as follows:
P1 | P2 | P1 | P2 | P3 | P4 | P3 |
0 2 4 6 7 10 15 20
In the above example, P1 and P2 in queue-1 run first as they are of higher priority, they will follow the round-robin scheduling. After 7 units, P3 in queue-2 starts running as processes in queue-1 have completed. P4 comes and interrupts P3 and runs for 5 seconds after which the CPU is taken by P3 till it is fully executed.
Multilevel Queue Scheduling Of Operating System.