A Comprehensive Study of CPU Scheduling Algorithms
A Comprehensive Study of CPU Scheduling Algorithms
-------------------------------------------------------------------------------------------------------------------------------------
Date of Submission: 20-11-2020 Date of Acceptance: 03-12-2020
--------------------------------------------------------------------------------------------------------------------------------------
ABSTRACT: In the operating system, Scheduling to scale back this overhead, the OS must schedule
of CPU plays a vital role in designing. The main the roles to urge the optimal utilization of CPU and
objective of our project is to compare different to avoid the likelihood to deadlock.
types of algorithms like First Come First Served
Scheduling, Shortest Job First Scheduling, Priority I. INTRODUCTION
Scheduling, Round Robin Scheduling, which helps Nowadays the operating system is more
us to improve the CPU efficiency and Timesharing complex, they are working on multitasking,
in the operating system. This paper depicts the multiprocessing environment in which process is
study of various scheduling algorithms for a CPU executed concurrently. The need for a scheduling
with the help of the Gantt chart. algorithm arises from the requirement for most
Why CPU scheduling? modern systems to perform multitasking (execute
In the uni-programming systems, when a process more than one process at a time) and
waits for an I/O operation, the CPU remains idle. multiprocessing (transmit multiple flows
This is an overhead and it wastes the time and simultaneously). There are several scheduling
causes the problem of starvation. However, In algorithms available as FCFS (First Come First
Multiprogramming systems, the CPU doesn't Serve), SJF (Shortest Job First), Priority
remain idle during the waiting time of the Process Scheduling, and RR (Round Robin) scheduling
and it executes other processes. algorithm. There are some scheduling criteria, like
In Multiprogramming systems, the Operating turnaround time, response time, waiting time, and
system schedules the processes of the CPU to make several contexts switching based on these criteria
maximum utilization of it and this is called CPU we analyze and determine which scheduling
scheduling. The Operating System uses various algorithm is best. In this paper, we introduce basic
scheduling algorithm to schedule the processes of CPU-scheduling concepts and present several
the CPU. CPU-scheduling algorithms.
The short-term scheduler schedules the task of
CPU for the number of processes present in the Job II. ORGANIZATION OF THE PAPER
Pool. (Section iii) describes the dispatcher
Whenever the running process requests some I/O (section iv) describes the types of scheduling
operation then the short-term scheduler saves the (section v)
present context of the method called PCB and Describes the scheduling criteria (section vi)
changes its state from running to waiting. Now the describes various CPU scheduling algorithms with
process is in waiting state; the Short-term scheduler their Gantt charts (section vii) contains the
picks another process from the ready queue and conclusion (section viii) provides the references
assigns the CPU to the present process. This
procedure is named context switching. In III. CPU SCHEDULING: DISPATCHER
Multiprogramming, if the long-term scheduler has The dispatcher is one of the components
more I/O bound processes then most of the time, involved in the CPU scheduling function. The
the CPU remains idle. The task of OS is to dispatcher is a module that gives control to the
optimize the use of resources. CPU process selected by the short-term scheduler.
If most of the running processes change their state The functions are:
from running to waiting then there could also be an Switching context
opportunity of deadlock within the system. Hence Switching to user mode
DOI: 10.35629/5252-02100711 | Impact Factor value 7.429 | ISO 9001: 2008 Certified Journal Page 7
International Journal of Advances in Engineering and Management (IJAEM)
Volume 2, Issue 10, pp: 7-11 www.ijaem.net ISSN: 2395-5252
Jumping to the proper location in the user time). Considering a true system, CPU usage
program to restart that program from where it should range from 40% (lightly loaded) to
left last time. 90%(heavily loaded.)
The dispatcher should be as fast as 5.2 Throughput
possible, as long as it's invoked during every It is the entire number of processes
process switch. The time taken by the dispatcher to completed per unit time or rather says the total
prevent one process and start another process is amount of labor done in a unit of your time. this
Dispatch Latency. Dispatch Latency is often might range from 10/second to 1/hour counting on
explained using the below figure: the precise processes.
5.3 Turnaround Time
It is the quantity of your time taken to
execute a particular process, i.e. The interval from
the time of submission of the method to the time of
completion of the process (Wall clock time).
5.4 Waiting Time
The sum of the periods spent waiting
within the ready queue amount of your time a
process has been waiting within the ready queue to
accumulate get control on the CPU.
5.5 Load Average
It is the typical number of processes residing in the
ready queue expecting their address get into the
CPU.
IV. TYPES OF SCHEDULING. 5.6 Response Time
4.2 Medium-Term Scheduling The amount of your time it takes from
Long-term scheduling performs like a
when an invitation was submitted until the primary
gatekeeping function. It decides whether there is response is produced. Remember, it's the time till
enough memory, to allow jobs into the system. It
the primary response and not the completion of
limits the process of multi-tasking to prevent slow
process execution (final response). In common
performance on current-running programs. When a
CPU utilization and Throughput are maximized and
job gets into the long-term scheduler, it is sent on other factors are reduced for proper optimization.
to the medium-term scheduler.
DOI: 10.35629/5252-02100711 | Impact Factor value 7.429 | ISO 9001: 2008 Certified Journal Page 8
International Journal of Advances in Engineering and Management (IJAEM)
Volume 2, Issue 10, pp: 7-11 www.ijaem.net ISSN: 2395-5252
where the info element which is added to the To successfully implement it, the burst
queue first, is that the one who leaves the time/duration time of the processes should be
queue first. known to the processor beforehand, which is
This is employed in Batch Systems. practically not feasible all the time.This scheduling
It's easy to know and implement algorithm is perfect if all the jobs/processes are
programmatically, employing a Queue available at an equivalent time. (either time of
arrangement, where a replacement process arrival is 0 for all, or time of arrival is the same for
enters through the tail of the queue, and all)
therefore the scheduler selects a process from
the top of the queue. 6.2.1 Non-Preemptive Shortest Job First
Poor in performance because the average wait Consider the below processes available in the ready
time is high. queue for execution, with arrival time as 0 for all
A perfect real-life example of FCFS and given burst times.
scheduling is buying tickets at the ticket
counter.
Consider the processes P1, P2, P3, P4 given in the
below table, arrives for execution in the same
order, with Arrival Time 0, and given Burst Time,
let's find the average waiting time using the FCFS
scheduling algorithm.
DOI: 10.35629/5252-02100711 | Impact Factor value 7.429 | ISO 9001: 2008 Certified Journal Page 10
International Journal of Advances in Engineering and Management (IJAEM)
Volume 2, Issue 10, pp: 7-11 www.ijaem.net ISSN: 2395-5252
REFERENCE
[1]. William Stallings, "Operating systems
Internals and Design Principles", 4th edition,
PHI, 2001.
[2]. https://www.wikipedia.org/
[3]. Silberschatz A., Peterson J.L and Galvin P.,
"Operating System Concepts", John Wiley
Publishing Company, 2002.
[4]. H.M.Deital, " An introduction to Operating
when P1 enters, it gets executed. P2, P3, and P4 System", Pearson Education, 2001
will be waiting. After the execution of P1, the [5]. Charles Crowley, "Operating System a
process with the highest response ratio must be Design Oriented Approach", Tata McGraw
executed. Hill, 2000.
RR(P2) = (21-1)+3/3=7.666 [6]. Milankovic M, "Operating System Concepts
RR(P3) = (21-2)+6/6=4.166 & Design", McGraw Hill,1999.
RR(P4) = (21-3)+2/2=10 [7]. ArmassDanesl, "Mastering Linux", Premium
Hence, P4 will be executed next since it has the Edition, BPB Publications, 1999.
highest response ratio.
RR(P2) = (23-1)+3/3=8.333
RR(P3) = (23-2)+6/6=4.5
P2 will be executed and then P3 will be executed.
DOI: 10.35629/5252-02100711 | Impact Factor value 7.429 | ISO 9001: 2008 Certified Journal Page 11