0% found this document useful (0 votes)
26 views18 pages

HRRN MLQ Scheduling

Uploaded by

prabidushk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views18 pages

HRRN MLQ Scheduling

Uploaded by

prabidushk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

CPU Scheduling Algorithms

Highest Response Ratio Next (HRRN)


& Multi-Level Queue (MLQ)
Scheduling
Introduction to CPU Scheduling
• - CPU scheduling is a fundamental OS function
• - It determines which process runs next
• - Different algorithms balance efficiency and
fairness
• - We will discuss HRRN and MLQ scheduling
Highest Response Ratio Next (HRRN)
Scheduling
• - HRRN prioritizes processes based on
response ratio
• - Formula: Response Ratio = (Waiting Time +
Burst Time) / Burst Time
• - The process with the highest response ratio
is selected
Highest Response Ratio Next (HRRN)
Scheduling
• non-preemptive CPU Scheduling
algorithm
• considered as one of the most optimal
scheduling algorithms
• considered as the modification of
the Shortest Job First to reduce the
problem of starvation.
• CPU is allotted to the next process which
has the highest response ratio, and not to
the process having less burst time.
HRRN Scheduling - Example
HRRN Scheduling - Example
HRRN Scheduling - Example
HRRN Scheduling - Example
HRRN: Pros & Cons
• - ✅ Fairness: considers both the waiting time and burst time of
processes.
• - ✅ Better Response Time: prioritizes processes that have
been waiting for a longer period
• - ✅ No Starvation:processes that need more CPU time will
eventually get executed
• - ✅ No Starvation:processes that need more CPU time will
eventually get executed
• - ✅ Simple to Implement: only requires calculating the
response ratio and selecting the process with the highest
ratio.
HRRN: Pros & Cons
• - ❌ not practically feasible because we cannot predict the
burst time of every process in advance.

• - ❌ requires the calculation of the response ratio for each


process, which adds some computational overhead, especially
in systems with a large number of processes.
Multi-Level Queue (MLQ) Scheduling
• - MLQ scheduling divides processes into
different priority queues
• - Each queue may have its own scheduling
algorithm
• - Commonly used in multi-user and real-time
systems
MLQ Scheduling - Example
• - Example: 3 queues (System, Interactive,
Batch)
• - System queue gets highest priority, Batch
lowest
• - CPU serves queues based on predefined
priority order
MLQ Scheduling - Example

System Processes
Highest Priority (FCFS)

Interactive Processes
CPU
Medium Priority (SJF)

Batch Processes
Lowest Priority (RR)
HRRN: Pros & Cons
• - ✅ Low Scheduling Overhead: scheduler only needs to select the appropriate
queue for execution.

• - ✅ Efficient Allocation of CPU Time: processes with higher priority levels are
executed in a timely manner, while still allowing lower priority processes to
execute when the CPU is idle.

• - ✅ Customizable: algorithm can be customized to meet the specific requirements


of different types of processes. Different scheduling algorithms can be used for
each queue
• - ✅ Prioritization: Priorities are assigned to processes based on their type,
characteristics, and importance, which ensures that important processes are
executed in a timely manner.
• - ✅ Preemption: Preemption is allowed, which means that higher-priority
processes can preempt lower-priority processes. This helps ensure that high-
priority processes are executed in a timely manner.
HRRN: Pros & Cons
• - ❌ Some processes may starve for CPU if some higher priority
queues are never becoming empty.

• - ❌ inflexible in nature.
• - ❌ added complexity in implementing and maintaining
multiple queues and scheduling algorithms.
HRRN vs. MLQ Scheduling
Conclusion & Key Takeaways
• - HRRN improves fairness by balancing waiting
and execution time
• - MLQ is ideal for multi-user or real-time
systems
• - Choosing the right algorithm depends on
system requirements
Lab Assignment
• Write C++ code for implementing HRRN
scheduling algorithm.

• Write C++ code for implementing Multi-Queue


scheduling. Implement three queues : FCFS,
SJF, Round Robin.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy