University of Sulaimani
College of Commerce
CPU Scheduling algorithms
Submitted By
Kosar Luqman & Mardin Ahmad
Supervised by
Dr. Jaza Mahmood Abdullah
2721 2022
1
Introduction
Today's operating systems are capable of handling several tasks. However, we
know that only one task can run at a time. The CPU then uses a scheduling
algorithm to organize and govern the multiple tasks in the system while also
maximizing CPU utilization. CPU scheduling is the decides which threads,
processes or data flows are given access to system resources (e.g. processor
time, communications bandwidth). This is usually done to load balance a system
effectively or achieve a target quality of service.
Types of CPU scheduling Algorithm
1. Preemptive
Prioritized computing is the driving force behind preemptive scheduling.
It needs that the process with the highest priority be the one that is currently using
the processor. If a process is currently using the processor and a new process with
a higher priority enters the ready list, the process on the processor should be
removed and returned to the ready list until it is once again the highest-priority
process in the system.
2. Non-preemptive
Non-preemptive scheduling ensures that once a process has entered the running
state (allowing the resources to run), it cannot be removed from the processor until
the service time has expired.
CPU Scheduling Algorithms
Scheduling algorithms are methods for distributing resources among parties who
make requests simultaneously and asynchronously.
2
There are mainly six types of process scheduling algorithms:
1. First Come First Serve (FCFS)
One of the most basic and straightforward algorithm strategies is FCFS
(First-Come, First-Served) or FIFO (First-In, First-Out). The FCFS algorithm
simply processes the processes in the order in which they arrive in the ready queue.
When a process is registered, it is added to the end of the ready queue. When a
running operation is done, it is dequeued, and the process at the top of the ready
queue is started. Because FIFO is a non-preemptive algorithm, no process can be
forced to give up resources in the case that a higher-priority process joins the
queue.
2. Shortest-Job-First (SJF) Scheduling
The SJF (Shortest Job First) algorithm, also known as SPN (Shortest Process
Next), is very similar to the SRT (Shortest Remaining Time) algorithm, with only
the feature of preemption separating them. The process with the shortest expected
processing time is picked next in the non-preemptive SJF algorithm.
3. Multilevel Queue Scheduling
This algorithm divides the ready queue into several queues. Processes are assigned
to a queue using this algorithm based on a certain property of the process, such as
3
priority, memory size, and so on. This is not an independent scheduling OS method
because it requires the usage of other sorts of algorithms to schedule the jobs.
4. Round Robin Scheduling
Round-robin (RR) is a computational method used by process and network
schedulers. Time slices (also known as time quanta) are allocated to each process
in equal parts and in circular order, treating all processes without priority (also
known as cyclic executive). Round-robin scheduling is simple, straightforward,
and free of starvation. Other scheduling issues, such as data packet scheduling in
computer networks, can benefit from round-robin scheduling.
5. Priority Scheduling
It uses a round-robin strategy to run the highest-priority processes first among
processes of equal priority. If a new job is received, the scheduler places it in the
run queue after all processes of equal or greater priority. Priority scheduling helps
OS’s in implementing priority assignments. Jobs with higher priorities should be
executed first, whereas jobs with equal priorities should be executed in a
round-robin or FCFS method. Prioritization can be chosen based on memory
limitations, time constraints, etc.