/    /  OS – Multilevel Queue Scheduling

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:

  1. System Processes
  2. Interactive Processes
  3. Interactive Editing Processes
  4. Batch Processes
  5. 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:

  1. Multilevel queue scheduling helps us apply different scheduling algorithms for different processes. 
  2. It will have a low scheduling overhead.

Disadvantages:

Some of the disadvantages of Multilevel queue scheduling are as follows:

  1. There are chances of starving for the lower priority processes.
  2. It is inflexible in nature.

Example of Multilevel queue scheduling:

Let us consider the following 4 processes:

ProcessBurst timeArrival timeQueue number
P1401
P2301
P3802
P45101

 

The Gantt Chart will be as follows:

 

P1P2P1P2P3P4P3

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. 

 

Reference:

Multilevel Queue Scheduling Of Operating System.