MULTILEVEL
QUEUE
SCHEDULING
ALGORITHM
What is Multilevel Queue Scheduling?
A multi-level queue scheduling algorithm partitions the
ready queue into several separate queues. The processes
are permanently assigned to one queue, generally based on
some property of the process, such as memory size, process
priority, or process type. Each queue has its own
scheduling algorithm.
It is created for areas in which we classify process into
different groups such as foreground processes and
background processes.
What is Multilevel Queue Scheduling?
Priority of foreground processes are higher than
background process. The foreground queue might be
scheduled by the Round Robin algorithm, while the
background queue is scheduled by an FCFS algorithm.
For the process in a queue to execute, all the queues of
priority higher than it should be empty, meaning the
process in those high priority queues should have
completed its execution
Advantages Disadvantages
We can apply separate Some processes may starve for
scheduling for various kind of CPU if some higher priority
process like queues are never becoming
empty.
System process-FCFS scheduling It is inflexible in nature.
algorithm
Interactive process-SJF scheduling
Batch process-Round Robin
Student process- Priority
scheduling
EXAMPLE
PROBLEM
Consider below table of four processes under Multilevel Queue Scheduling. Queue number denotes the
queue of the process.
PROCESS BURST TIME QUEUE N0. ARRIVAL TIME
P1 5 1 0
P2 3 1 0
P3 8 2 0
P4 2 1 10
Priority of queue 1 is greater than queue 2. queue 1 uses Round Robin (Time Quantum = 2) and
queue 2 uses FCFS.
PROCESS BURST TIME QUEUE N0. ARRIVAL
TIME
P1 5 1 0
P2 3 1 0
P3 8 2 0
P4 2 1 10
GANTT
CHART
P1 P2 P1 P2 P1 P3 P4 P3
0 2 4 6 7 8 10 12 18
PROCESS BURST TIME QUEUE N0. ARRIVAL COMPLETION
TIME TIME
P1 5 1 0 8
P2 3 1 0 7
P3 8 2 0 18
P4 2 1 10 12
GANTT
CHART
P1 P2 P1 P2 P1 P3 P4 P3
0 2 4 6 7 8 10 12 18
FORMULA FOR TURNAROUND TIME= COMPLETION TIME- ARRIVAL TIME
P1=8-0=8 P2=7-0=7
P3=18-0=18 P4=12-10=2
BURST TIME QUEUE N0. ARRIVAL TURNAROUN
PROCESS TIME COMPLETIO D TIME
N TIME
P1 5 1 0 8 8
P2 3 1 0 7 7
P3 8 2 0 18 18
P4 2 1 10 12 2
GANTT
CHART
P1 P2 P1 P2 P1 P3 P4 P3
0 2 4 6 7 8 10 12 18
FORMULA FOR WAITING TIME= TURNAROUND TIME- BURST TIME
P1=8-5=3 P2=7-3=4
P3=18-8=10 P4=12-2=10
PROCESS BURST TIME QUEUE ARRIVAL COMPLET TURNAROU WAITING
N0. TIME ION TIME ND TIME TIME
P1 5 1 0 8 8 3
P2 3 1 0 7 7 4
P3 8 2 0 18 18 10
P4 2 1 10 12 2 10
GANTT
CHART
P1 P2 P1 P2 P1 P3 P4 P3
0 2 4 6 7 8 10 18
TURNAROUND TIME AVERAGE=TOTAL TURNAROUND TIME/TOTAL PROCESSES
8+7+18+2=40/4=10
WAITING TIME AVERAGE=TOTAL WAITING TIME/TOTAL PROCESSES
3+4+10+10=27/4=6.75