# Multilevel Feedback Queue scheduling Tutorial With Example

In this tutorial, we will learn about multilevel feedback queue scheduling. we will see an example of multilevel feedback queue scheduling that explains how does this scheduling work with different processes. Also, we will see how it overcomes the disadvantages of multilevel queue scheduling.

In Multilevel Feedback Queue, Process can move between the queues. It uses many ready queue and associate a different priority with each queue. Multilevel Queue scheduling doesn’t allow us to do this. So, this was the disadvantages of Multilevel Queue scheduling.

Consider Processes with different CPU burst characteristic. If a process uses too much of the CPU, it will be moved to a lower priority queue. In same way, a process that waits too much in a lower priority queue may be moved to a higher priority queue.

While implementing a Multilevel Feedback queue, there are various parameters that define the schedulers –

• The number of queues
• The scheduling algorithm for each queue
• The method used to demote processes to lower priority queues
• The method used to promote processes to higher priority queues
• The method used to determine which queue a process will enter

Let us take an example to understand:

Let’s consider there are three queues Q1, Q2 and Q3.

– Q1 Time quantum 9 milliseconds
– Q2 Time quantum 18 milliseconds
– Q3 FCFS

Criteria of Multilevel Feedback Queue –

• The scheduler first executes all processes in Q1.
• Only when Q1 is empty will it executes processes in Q2.
• Similarly, processes in Q3 will be executed only if Q1 and Q2 are empty.
• A process that arrives for Q2 will preempt a process in Q3.
• A process that arrives for Q3 will, in turn, preempt a process in Q3.

MultiLevel FeedBack Queue Scheduling Example

#### Explanation

Any process entering the ready queue is put in Q1. Then, A process in Q1 is given a time quantum of 9 milliseconds. If it does not finish within time, it is moved to the tail of Q2.
If Q1 is empty, the process at the head of Q2 is given a quantum of 18 milliseconds. or, If it does not complete, it is preempted and is put into Q3.
Processes in Q3 are run on an FCFS basis, only when Q1 and Q2 are empty.