Professional Documents
Culture Documents
Osy Theory1
Osy Theory1
Abstract
Multilevel queue scheduling is a fundamental process management strategy used in modern
operating systems to efficiently manage processes with varying priorities and characteristics.
In this approach, processes are categorized into multiple priority-based queues, each with its
own scheduling policy and priority level. This segmentation ensures that high-priority
processes, such as system-critical tasks, receive immediate attention, while other processes,
such as interactive, batch, and student processes, are managed separately. This abstract
provides an overview of multilevel queue scheduling, its core principles, and its practical
applications in optimizing system performance and resource allocation.
The primary objective of multilevel queue scheduling is to strike a balance between system
stability, fairness, and responsiveness. By employing different scheduling policies for each
queue, the algorithm can ensure that critical system functions are executed promptly,
maintaining system reliability and preventing bottlenecks. Simultaneously, user interactions
are facilitated by providing short time quanta to interactive processes, offering a snappy user
experience. Batch and student processes, which are typically non-urgent and can be executed
in the background, are assigned lower priorities to avoid disruption of more critical tasks.
The adaptability of multilevel queue scheduling makes it a versatile tool in handling complex,
real-world scenarios. It allows for a mix of scheduling policies, such as First-Come-First-
Serve (FCFS), Round Robin, or Priority Scheduling, tailored to the specific requirements of
each process queue. This adaptability is particularly valuable in optimizing system
performance and resource allocation. However, configuring the priorities and time quantums
for each queue is crucial to achieving the desired system behavior. Multilevel queue
scheduling remains an essential component of modern operating systems, enabling them to
efficiently handle diverse types of processes and maintain system stability.
1
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
INTRODUCTION
The Multilevel Queue Scheduling is a dynamic scheduling algorithm used in operating
systems to manage the execution of multiple processes. In a computing environment, where
various processes with differing priority levels and execution characteristics compete for
system resources, an efficient scheduling mechanism becomes essential. Multilevel Queue
Scheduling is a powerful solution to this problem.
Multilevel Queue Scheduling in operating systems provides an effective means to manage the
dynamic and diverse workloads of modern computing environments. By categorizing
processes into different priority queues and applying specific scheduling policies to each, it
ensures that high-priority tasks receive timely attention while still allowing for the execution
of lower-priority background processes. This makes it a crucial component of responsive and
efficient operating systems.
1. System Processes
2. Interactive Processes
4. Batch Processes
5. Student Process
Each queue has absolute priority over lower-priority queues. No process in the batch
queue, for example, could run unless the queues for system processes, interactive
processes, and interactive editing processes were all empty. If an interactive editing
process entered the ready queue while a batch process was running, the batch process will
be preempted.
2
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Diagram :
In this case, if there are no processes on the higher priority queue only then the processes on
the low priority queues will run. For Example: Once processes on the system queue, the
Interactive queue, and Interactive editing queue become empty, only then the processes on
the batch queue will run.
1. System Process:
3
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
System processes represent the core operations of the operating system itself.
These processes are responsible for managing and controlling various aspects of
the computer system, such as memory management, hardware resource allocation,
and I/O operations.
2. Interactive Process:
Interactive processes are those that require direct user interaction or real-time
responsiveness. These processes are often associated with tasks like running
online games or applications where user input and output are essential for a
smooth and responsive user experience.
Interactive processes typically receive a relatively high priority to ensure that user
interactions are processed promptly.
3. Batch Processes:
In the context of scheduling, batch processes may receive moderate priority, and
they are often executed in the order they are received.
4. Student Process:
The term "student process" suggests that these processes are of lower priority
compared to system and interactive processes. Student processes are usually non-
critical or non-urgent tasks that run in the background.
These processes are assigned lower priority to ensure that they do not interfere
with critical system operations or user interactions. Student processes may include
tasks like background downloads, maintenance processes, or non-essential
applications.
4
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
To efficiently manage these different types of processes with varying priorities, the program
employs a multilevel queue scheduling approach. Multilevel queue scheduling divides the
processes into different priority queues, each associated with a different priority level. The
highest-priority queue is typically reserved for system processes, while lower-priority queues
handle interactive, batch, and student processes.
This approach ensures that critical system operations are given priority while still allowing
for the execution of less critical tasks in a fair and organized manner. It helps maintain a
balance between system responsiveness and efficient resource utilization.
5
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Objectives
The objectives of the project are to develop a process scheduling and performance analysis
tool for an operating system. These objectives encompass the primary goals and outcomes
that the project is intended to achieve:
3. User Interaction: Allow user interaction to input process details and control the
execution of the program.
5. Average Metrics Calculation: Compute and display the average waiting time
and average turnaround time to assess the efficiency of the scheduling algorithm.
8. Scalability: Enable the tool to handle varying numbers of processes and provide
performance insights for different scenarios.
The project's objectives are designed to create a practical and educational tool that allows
users to interact with a simulated process scheduling system. It helps users understand how
process priorities impact system performance and provides valuable insights into multilevel
queue scheduling.
7
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Algorithm
3. Input process details (ID, burst time, system/user indicator) for each process in a loop.
4. Sort the processes based on the system/user indicator (0 for system, 1 for user).
5. Initialize the waiting time and turnaround time for the first process.
6. Calculate waiting times and turnaround times for each process in a loop.
8. Display the results in a table format, including process details, system/user indicator, burst
time, waiting time, and turnaround time.
8
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Implementation
#include<stdio.h>
int main()
scanf("%d",&n);
for(i=0;i<n;i++)
p[i] = i;
scanf("%d",&bt[i]);
scanf("%d", &su[i]);
for(i=0;i<n;i++)
for(k=i+1;k<n;k++)
temp=p[i];
p[i]=p[k];
p[k]=temp;
temp=bt[i];
9
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
bt[i]=bt[k];
bt[k]=temp;
temp=su[i];
su[i]=su[k];
su[k]=temp;
wtavg = wt[0] = 0;
for(i=1;i<n;i++)
for(i=0;i<n;i++)
return 0;
10
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Output
11
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Example Problem:
Consider the below table of four processes under Multilevel queue scheduling. Queue
number denotes the queue of the process.
Priority of queue 1 is greater than queue 2. queue 1 uses Round Robin (Time
Quantum = 2) and queue 2 uses FCFS.
Working:
At starting, both queues have process so process in queue 1 (P1, P2) runs first
(because of higher priority) in the round-robin fashion and completes after 7 units
Then process in queue 2 (P3) starts running (as there is no process in queue 1) but
while it is running P4 comes in queue 1 and interrupts P3 and start running for 5
seconds and
After its completion P3 takes the CPU and completes its execution.
12
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Features
1. Multiple queues: In MLQ scheduling, processes are divided into multiple queues
based on their priority, with each queue having a different priority level. Higher-
priority processes are placed in queues with higher priority levels, while lower-
priority processes are placed in queues with lower priority levels.
4. Scheduling algorithm: Different scheduling algorithms can be used for each queue,
depending on the requirements of the processes in that queue. For example, Round
Robin scheduling may be used for interactive processes, while First Come First Serve
scheduling may be used for batch processes.
6. Efficient allocation of CPU time: MLQ scheduling ensures that processes with higher
priority levels are executed in a timely manner, while still allowing lower priority
processes to execute when the CPU is idle.
7. Fairness: MLQ scheduling provides a fair allocation of CPU time to different types of
processes, based on their priority and requirements.
13
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Advantages
14
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Disadvantages
1. Some processes may starve for CPU if some higher priority queues are never
becoming empty.
2. It is inflexible in nature.
15
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
Conclusion
In conclusion, the multilevel queue scheduling project is a sophisticated and effective
approach to managing the allocation of resources and prioritizing processes in a computer
system. By dividing processes into different queues based on their characteristics and
assigning appropriate priorities, this scheduling algorithm helps ensure efficient resource
utilization, fairness, and responsiveness to varying workloads. It is a valuable tool for
optimizing system performance and meeting the diverse requirements of modern computing
environments.
One of the notable advantages of multilevel queue scheduling is its adaptability to diverse
real-world scenarios. In practical operating systems, processes often exhibit varying
execution requirements, and this scheduling algorithm excels in managing such complexity.
Additionally, each queue within the multilevel structure can employ a different scheduling
algorithm, providing flexibility to tailor the scheduling approach to meet specific system
demands. This versatility ensures that the algorithm can effectively manage a wide range of
workloads while maintaining optimal system performance. Nonetheless, configuring the
priorities and time quantums for each queue accurately is critical to ensuring the desired
outcome and avoiding resource underutilization or performance degradation. Overall,
multilevel queue scheduling remains a valuable tool for achieving efficient resource
allocation and performance optimization in complex computing environments.
Reference
16
GT &MC Vishnupuri, Nanded
OSY22517) Multilevel Queue Scheduling
https://www.javatpoint.com/multilevel-queue-scheduling-in-operating-
system#:~:text=Each%20algorithm%20supports%20a%20different,whose
%20execution%20can%20be%20delayed.
https://www.geeksforgeeks.org/multilevel-queue-mlq-cpu-scheduling/
https://www.studytonight.com/operating-system/multilevel-queue-scheduling
17
GT &MC Vishnupuri, Nanded