Types of CPU Scheduling Algorithms
Types of CPU Scheduling Algorithms
Disadvantages of FCFS
• FCFS suffers from Convoy effect.
• The average waiting time is much higher than the other algorithms.
• FCFS is very simple and easy to implement and hence not much efficient.
To learn about how to implement this CPU scheduling algorithm, please refer to our detailed article on First
come, First serve Scheduling.
2. Shortest Job First(SJF)
Shortest job first (SJF) is a scheduling process that selects the waiting process with the smallest execution
time to execute next. This scheduling method may or may not be preemptive. Significantly reduces the
average waiting time for other processes waiting to be executed. The full form of SJF is Shortest Job First.
Characteristics of SJF
• Shortest Job first has the advantage of having a minimum average waiting time among all operating
system scheduling algorithms.
• It is associated with each task as a unit of time to complete.
• It may cause starvation if shorter processes keep coming. This problem can be solved using the
concept of ageing.
Advantages of SJF
• As SJF reduces the average waiting time thus, it is better than the first come first serve scheduling
algorithm.
CPU Scheduling Algorithm
• When the higher priority work arrives and a task with less priority is executing, the higher priority
proess will takes the place of the less priority proess and
• The later is suspended until the execution is complete.
• Lower is the number assigned, higher is the priority level of a process.
Advantages of Priority Scheduling
• The average waiting time is less than FCFS
• Less complex
Disadvantages of Priority Scheduling
• One of the most common demerits of the Preemptive priority CPU scheduling algorithm is
the Starvation Problem. This is the problem in which a process has to wait for a longer amount of time
to get scheduled into the CPU. This condition is called the starvation problem.
To learn about how to implement this CPU scheduling algorithm, please refer to our detailed article
on Priority Preemptive Scheduling algorithm.
5. Round Robin
Round Robin is a CPU scheduling algorithm where each process is cyclically assigned a fixed time slot. It is
the preemptive version of First come First Serve CPU Scheduling algorithm. Round Robin CPU Algorithm
generally focuses on Time Sharing technique.
Characteristics of Round robin
• It’s simple, easy to use, and starvation-free as all processes get the balanced CPU allocation.
• One of the most widely used methods in CPU scheduling as a core.
• It is considered preemptive as the processes are given to the CPU for a very limited time.
Advantages of Round robin
• Round robin seems to be fair as every process gets an equal share of CPU.
• The newly created process is added to the end of the ready queue.
To learn about how to implement this CPU scheduling algorithm, please refer to our detailed article on
the Round robin Scheduling algorithm.
6. Shortest Remaining Time First(SRTF)
Shortest remaining time first is the preemptive version of the Shortest job first which we have discussed
earlier where the processor is allocated to the job closest to completion. In SRTF the process with the smallest
amount of time remaining until completion is selected to execute.
Characteristics of SRTF
• SRTF algorithm makes the processing of the jobs faster than SJF algorithm, given it’s overhead charges
are not counted.
CPU Scheduling Algorithm
• The context switch is done a lot more times in SRTF than in SJF and consumes the CPU’s valuable time
for processing. This adds up to its processing time and diminishes its advantage of fast processing.
Advantages of SRTF
• In SRTF the short processes are handled very fast.
• The system also requires very little overhead since it only makes a decision when a process completes
or a new process is added.
Disadvantages of SRTF
• Like the shortest job first, it also has the potential for process starvation.
• Long processes may be held off indefinitely if short processes are continually added.
To learn about how to implement this CPU scheduling algorithm, please refer to our detailed article on
the shortest remaining time first.
7. Longest Remaining Time First(LRTF)
The longest remaining time first is a preemptive version of the longest job first scheduling algorithm. This
scheduling algorithm is used by the operating system to program incoming processes for use in a systematic
way. This algorithm schedules those processes first which have the longest processing time remaining for
completion.
Characteristics of LRTF
• Among all the processes waiting in a waiting queue, the CPU is always assigned to the process having
the largest burst time.
• If two processes have the same burst time then the tie is broken using FCFS i.e. the process that
arrived first is processed first.
• LRTF CPU Scheduling can be of both preemptive and non-preemptive.
• No other process can execute until the longest task executes completely.
• All the jobs or processes finish at the same time approximately.
Advantages of LRTF
• Maximizes Throughput for Long Processes.
• Reduces Context Switching.
• Simplicity in Implementation.
Disadvantages of LRTF
• This algorithm gives a very high average waiting time and average turn-around time for a given set of
processes.
• This may lead to a convoy effect.
CPU Scheduling Algorithm
To learn about how to implement this CPU scheduling algorithm, please refer to our detailed article on
the longest remaining time first.
8. Highest Response Ratio Next(HRRN)
Highest Response Ratio Next is a non-preemptive CPU Scheduling algorithm and it is considered as one of
the most optimal scheduling algorithms. The name itself states that we need to find the response ratio of all
available processes and select the one with the highest Response Ratio. A process once selected will run till
completion.
Characteristics of HRRN
• The criteria for HRRN is Response Ratio, and the mode is Non-Preemptive.
• HRRN is considered as the modification of Shortest Job First to reduce the problem of starvation.
• In comparison with SJF, during the HRRN scheduling algorithm, the CPU is allotted to the next process
which has the highest response ratio and not to the process having less burst time.
Response Ratio = (W + S)/S
Here, W is the waiting time of the process so far and S is the Burst time of the process.
Advantages of HRRN
• HRRN Scheduling algorithm generally gives better performance than the shortest job first Scheduling.
• There is a reduction in waiting time for longer jobs and also it encourages shorter jobs.
Disadvantages of HRRN
• The implementation of HRRN scheduling is not possible as it is not possible to know the burst time of
every job in advance.
• In this scheduling, there may occur an overload on the CPU.
To learn about how to implement this CPU scheduling algorithm, please refer to our detailed article
on Highest Response Ratio Next.
9. Multiple Queue Scheduling
Processes in the ready queue can be divided into different classes where each class has its own scheduling
needs. For example, a common division is a foreground (interactive) process and a background
(batch) process. These two classes have different scheduling needs. For this kind of situation Multilevel
Queue Scheduling is used.
CPU Scheduling Algorithm
Average
Algorithm Allocation is Complexity waiting time Preemption Starvation Performance
(AWT)
According to
the arrival
Simple and
time of the Slow
FCFS easy to Large. No No
processes, the performance
implement
CPU is
allocated.
Based on the
More Minimum
lowest CPU Smaller than
SJF complex No Yes Average
burst FCFS
than FCFS Waiting Time
time (BT).
Depending
on some
Based on the More measures
Big turn-
LJFS highest CPU complex e.g., arrival No Yes
around time
burst time (BT) than FCFS time,
process size,
etc.
Same as LJFS
the allocation Depending
of the CPU is on some
The
based on the More measures
preference is
LRTF highest complex e.g., arrival Yes Yes
given to the
CPU burst than FCFS time,
longer jobs
time (BT). But process size,
it is etc.
preemptive
CPU Scheduling Algorithm
Average
Algorithm Allocation is Complexity waiting time Preemption Starvation Performance
(AWT)
Same as SJF
Depending
the allocation
on some
of the CPU is The
More measures
based on the preference is
SRTF complex e.g., arrival Yes Yes
lowest CPU given to the
than FCFS time,
burst time short jobs
process size,
(BT). But it is
etc
preemptive.
According to The
Large as
the order of complexity Each process
compared to
the process depends on has given a
RR SJF and Yes No
arrives with Time fairly fixed
Priority
fixed time Quantum time
scheduling.
quantum (TQ) size
According to Well
Priority the priority. performance
This type is Smaller than
Pre- The bigger Yes Yes but contain a
less complex FCFS
emptive priority task starvation
executes first problem
According to
the priority
with This type is Most
Priority Preemptive
monitoring less complex beneficial
non- Smaller than No Yes
the new than Priority with batch
preemptive FCFS
incoming preemptive systems
higher priority
jobs
More
According to Smaller than Good
MLQ complex No Yes
the process FCFS performance
than the
that resides in but contain a
priority
CPU Scheduling Algorithm
Average
Algorithm Allocation is Complexity waiting time Preemption Starvation Performance
(AWT)
It is the most
According to Complex but Smaller than
the process of its all
Good
MFLQ a bigger complexity scheduling No No
performance
priority rate depends types in
queue. on the TQ many cases
size