What is multi-level queue scheduling?

Operating systems use various scheduling algorithms to schedule the execution of different processes on the CPU. Some scheduling algorithms are as follows:

  • First come first served (FCFS) scheduling

  • Shortest job next (SJN) scheduling

  • Priority scheduling

  • Shortest remaining time

  • Round robin (RR) scheduling

  • Multiple-level queues scheduling

Note: Algorithms are either preemptivePreemptive scheduling is based on priority where a scheduler may preempt a low priority running process anytime when a high priority process enters into a ready state. or non-preemptiveNon-preemptive algorithms are designed so that once a process enters the running state, it cannot be preempted until it completes its allotted time..

In this answer, we'll discuss the multiple-level queues scheduling algorithm.

Methodology

All ready-state queue processes can be classified into different classes in multiple-level queue scheduling. Each class can follow its scheduling algorithm based on its requirements.

Note: This scheduling can be preemptive or non-preemptive, depending on the conditions of the processes.

For instance, a standard division of processes is between a foreground (interactive) process and a background (batch) process. Both of these processes need different scheduling. In such cases, we use multilevel queue scheduling. Both processes are permanently assigned to separate queues based on some requirements or properties such as process priority or process type, and then each queue can follow separate scheduling.

Example

Suppose we have five following processes of different nature. Let's schedule them using a multilevel queue scheduling:

Process ID

Process Type

Description

P1

System Process

The core process of OS.

P2

Interactive Process

A process with the same type of interaction.

P3

Interactive Editing Process

A type of interactive process.

P4

Batch Process

An OS feature that collects data and instructions into a batch before processing.

P5

Student Process

Process of lowest priority.

Solution

Let's handle this process scheduling using multilevel queue scheduling. To understand this better, look at the figure below:

The above illustration shows the division of queues based on priority. Every single queue has an absolute priority over the low-priority queue, and no other process is allowed to execute until the high-priority queues are empty. For instance, if the interactive editing process enters the ready queue while the batch process is underway, then the batch process will be preempted.

Let's take a numerical example now:

Numerical Example

Process

Arrival Time

Burst Time

Queue Number

P1

0

4

1

P2

0

3

1

P3

0

8

2

P4

10

5

4

The queue number 11 has a higher priority than the queue number 22 . The queue 11 uses round-robin scheduling with time quantum =2=2 , while the queue 22 uses FCFS.

Gantt chart

Let's look at the Gantt chartA Gantt chart, commonly used in project management, is one of the most popular and useful ways of showing activities (tasks or events) displayed against unit time. of our example:

Execution

  1. The two queues are handled at the start. Queue 1 run first because it has high priority using round-robin scheduling and finishes the execution after 7 unit time.

  2. After queue 1, the process from queue 2 starts execution. While it is executing, process P4 enters Queue 1 and interrupts the execution of P3, and then P3 takes the CPU until its execution.

Advantages

The advantages of multilevel queue scheduling are the following:

  • Users can apply different scheduling methods to every queue to distinguish the processes.

  • The scheduling overhead is very low.

Disadvantages

The disadvantages of multilevel queue scheduling are the following:

  • The process may go into starvation if it has low priority.

  • This scheduling is rigid and difficult to implement.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved