SlideShare a Scribd company logo
1 of 17
WELCOME
Presentation on
“ Different CPU scheduling algorithms,
make comparative chart to calculate
turnaround and waiting time ”
CPU Scheduling is a process of determining which process will own CPU for execution while another
process is on hold. The main task of CPU scheduling is to make sure that whenever the CPU remains idle,
the OS at least select one of the processes available in the ready queue for execution. The selection process
will be carried out by the CPU scheduler. It selects one of the processes in memory that are ready for
execution.
Introduction :
Scheduling is one of the basic functions of any operating system, because scheduling
of all the computer resources is done before their user. The CPU the most essential computer resource.
Types of CPU scheduling Algorithms:
There are mainly six types of process scheduling algorithms
1)First Come First Serve (FCFS)
2)Shortest-Job-First (SJF) Scheduling
3)Shortest Remaining Time
4)Priority Scheduling
5)Round Robin Scheduling
6)Multilevel Queue Scheduling
First Come First Serve (FCFS) :-
 In the "First come first serve" scheduling algorithm, as the name suggests, the process
which arrives first, gets executed first, or we can say that the process which requests the
CPU first, gets the CPU allocated first.
 First Come First Serve, is just like FIFO (First in First out) Queue data structure, where the
data element which is added to the queue first, is the one who leaves the queue first.
 This is used in Batch Systems.
 It's easy to understand and implement programmatically, using a Queue data structure,
where a new process enters through the tail of the queue, and the scheduler selects process
from the head of the queue.
 A perfect real life example of FCFS scheduling is buying tickets at ticket counter.
Advantages of FCFS:-
1) It is easy to implement.
2) It is easy to understand.
3) First come, First serve
Disadvantages of FCFS : –
1) The process with less execution time suffer i.e. waiting time is often quite
long.
2) Favors CPU Bound process then I/O bound process.
3) Here, first process will get the CPU first, other processes can get CPU only
after the current process has finished it’s execution. Now, suppose the first
process has large burst time, and other processes have less burst time, then
the processes will have to wait more unnecessarily, this will result in more
average waiting time, i.e., Convey effect.
Ex :
Gantt chart of the example
Turnaround Time for p1= (24-0) = 24
Turnaround Time for p2= (27-0) = 27
Turnaround Time for p3= (32-0) = 32
Average Turnaround Time = (24+27+32)/3 =27.67
Waiting Time for p1 = 0
Waiting Time for p2 = 24
Waiting Time for p3 = 27
Average Waiting Time = (0+24+27)/3 = 17
P1 P2 P3
0 24 27 32
Process Burst time
P1 24
P2 03
P3 05
2. Shortest-Job-First (SJF) Scheduling:-
Till now, we were scheduling the processes according to their arrival time (in FCFS
scheduling). However, SJF scheduling algorithm, schedules the processes according to their
burst time.
In SJF scheduling, the process with the lowest burst time, among the list of available processes
in the ready queue, is going to be scheduled next.
However, it is very difficult to predict the burst time needed for a process hence this algorithm
is very difficult to implement in the system.
Advantages of Shortest Job First (SJF):-
Maximum throughput.
Minimum average waiting and turnaround time.
Disadvantages of Shortest Job First (SJF):-
May suffer with the problem of starvation
It is not implementable because the exact Burst time for a process can't be known in advance.
3. Shortest Remaining Time:-
This Algorithm is the preemptive version of SJF scheduling. In SRTF, the execution of
the process can be stopped after certain amount of time. At the arrival of every process, the
short term scheduler schedules the process with the least remaining burst time among the list of
available processes and the running process.
Once all the processes are available in the ready queue, No preemption will be done and the
algorithm will work as SJF scheduling. The context of the process is saved in the Process
Control Block when the process is removed from the execution and the next process is
scheduled. This PCB is accessed on the next execution of this process.
Advantages of Shortest Remaining Time:-
1)Short-burst jobs run fast
Disadvantages of Shortest Remaining Time:-
1) Long-burst (CPU intensive) jobs get a long mean waiting time
2) Rely on ability to estimate CPU burst length
4. Priority Scheduling:-
In this tutorial we will understand the priority scheduling algorithm, how it works and its advantages and
disadvantages.
In the Shortest Job First scheduling algorithm, the priority of a process is generally the inverse of the
CPU burst time, i.e. the larger the burst time the lower is the priority of that process.
In case of priority scheduling the priority is not always set as the inverse of the CPU burst time, rather it
can be internally or externally set, but yes the scheduling is done on the basis of priority of the process
where the process which is most urgent is processed first, followed by the ones with lesser priority in
order.
Processes with same priority are executed in FCFS manner.
Advantages of Priority Scheduling:-
 The priority of process is selected on the basis of memory requirement, user preference or
the requirement of time.
 Processes are executed on the basis of priority. So high priority does not need to wait for
long which saves time.
 It is easy to use.
 It is a user friendly algorithm.
 Simple to understand.
 it has reasonable support for priority.
Disadvantages of Priority Scheduling:-
 Some low priority processes waiting indefinitely.
 A process will be blocked when it is ready to run but has to wait for the CPU because some
other process is running currently.
 If a new higher priority process keeps on coming in the ready queue, If the system eventually
crashes, all low priority processes get lost.
If high priority processes take lots of CPU time, then the lower priority processes may starve and
will be postponed for an indefinite time
5. Round Robin Scheduling:-
The name of this algorithm comes from the round-robin principle, where each person gets an equal share of
something in turns. It is the oldest, simplest scheduling algorithm, which is mostly used for multitasking.
In Round-robin scheduling, each ready task runs turn by turn only in a cyclic queue for a limited time slice.
This algorithm also offers starvation free execution of processes.
Advantages of Round Robin algorithm:-
 It doesn't face the issues of starvation or convoy effect.
 All the jobs get a fair allocation of CPU.
 It deals with all process without any priority
 If you know the total number of processes on the run queue, then you can also assume the worst-case
response time for the same process.
 This scheduling method does not depend upon burst time. That's why it is easily implementable on the
system.
 Once a process is executed for a specific set of the period, the process is preempted, and another process
executes for that given time period.
Disadvantages of Round Robin algorithm:-
 If slicing time of OS is low, the processor output will be reduced.
 This method spends more time on context switching
 Its performance heavily depends on time quantum.
 Priorities cannot be set for the processes.
 Round-robin scheduling doesn't give special priority to more important tasks.
 Decreases comprehension
 Lower time quantum results in higher the context switching overhead in the system.
 Finding a correct time quantum is a quite difficult task in this system.
6. Multilevel Queue Scheduling:-
It may happen that 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 background
(batch) processes. These two classes have different scheduling needs. For this kind of situation Multilevel Queue
Scheduling is used . Now, let us see how it works.
Ready Queue is divided into separate queues for each class of processes. For example, let us take three different types
of process System processes, Interactive processes and Batch Processes.
Advantages of Multilevel Queue Scheduling:
1) The processes are permanently assigned to the queue, so it has advantage of low scheduling overhead.
Disadvantages of Multilevel Queue Scheduling:
1) Some processes may starve for CPU if some higher priority queues are never becoming empty.
It is inflexible in nature.
Comparison Between the different CPU Scheduling Algorithm
Conclusion
1.Scheduling algorithms should not affect the behavior of the.
system (same results regardless of schedule).
2.However, the algorithms do impact the system's efficiency
and response time.
3.The best schemes are adaptive. To do absolutely best, we'd
have to be able to predict the future.
Thank You

More Related Content

Similar to Osy ppt - Copy.pptx

Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
rohassanie
 

Similar to Osy ppt - Copy.pptx (20)

PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
 
cospptagain.pptx
cospptagain.pptxcospptagain.pptx
cospptagain.pptx
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
Cpu scheduling final
Cpu scheduling finalCpu scheduling final
Cpu scheduling final
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process Scheduling
 
cosppt.pptx
cosppt.pptxcosppt.pptx
cosppt.pptx
 
Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
CPU scheduling in Operating System Explanation
CPU scheduling in Operating System ExplanationCPU scheduling in Operating System Explanation
CPU scheduling in Operating System Explanation
 
Cpu scheduling pre final formatting
Cpu scheduling pre final formattingCpu scheduling pre final formatting
Cpu scheduling pre final formatting
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
 
Operating system
Operating systemOperating system
Operating system
 
exp 3.docx
exp 3.docxexp 3.docx
exp 3.docx
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
 
20118016 aryan sabat study and analysis of scheduler design
20118016 aryan sabat study and analysis of scheduler design20118016 aryan sabat study and analysis of scheduler design
20118016 aryan sabat study and analysis of scheduler design
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Unit 2 notes
Unit 2 notesUnit 2 notes
Unit 2 notes
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU Scheduling
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

Osy ppt - Copy.pptx

  • 2. Presentation on “ Different CPU scheduling algorithms, make comparative chart to calculate turnaround and waiting time ”
  • 3. CPU Scheduling is a process of determining which process will own CPU for execution while another process is on hold. The main task of CPU scheduling is to make sure that whenever the CPU remains idle, the OS at least select one of the processes available in the ready queue for execution. The selection process will be carried out by the CPU scheduler. It selects one of the processes in memory that are ready for execution. Introduction : Scheduling is one of the basic functions of any operating system, because scheduling of all the computer resources is done before their user. The CPU the most essential computer resource.
  • 4. Types of CPU scheduling Algorithms: There are mainly six types of process scheduling algorithms 1)First Come First Serve (FCFS) 2)Shortest-Job-First (SJF) Scheduling 3)Shortest Remaining Time 4)Priority Scheduling 5)Round Robin Scheduling 6)Multilevel Queue Scheduling
  • 5. First Come First Serve (FCFS) :-  In the "First come first serve" scheduling algorithm, as the name suggests, the process which arrives first, gets executed first, or we can say that the process which requests the CPU first, gets the CPU allocated first.  First Come First Serve, is just like FIFO (First in First out) Queue data structure, where the data element which is added to the queue first, is the one who leaves the queue first.  This is used in Batch Systems.  It's easy to understand and implement programmatically, using a Queue data structure, where a new process enters through the tail of the queue, and the scheduler selects process from the head of the queue.  A perfect real life example of FCFS scheduling is buying tickets at ticket counter.
  • 6. Advantages of FCFS:- 1) It is easy to implement. 2) It is easy to understand. 3) First come, First serve Disadvantages of FCFS : – 1) The process with less execution time suffer i.e. waiting time is often quite long. 2) Favors CPU Bound process then I/O bound process. 3) Here, first process will get the CPU first, other processes can get CPU only after the current process has finished it’s execution. Now, suppose the first process has large burst time, and other processes have less burst time, then the processes will have to wait more unnecessarily, this will result in more average waiting time, i.e., Convey effect.
  • 7. Ex : Gantt chart of the example Turnaround Time for p1= (24-0) = 24 Turnaround Time for p2= (27-0) = 27 Turnaround Time for p3= (32-0) = 32 Average Turnaround Time = (24+27+32)/3 =27.67 Waiting Time for p1 = 0 Waiting Time for p2 = 24 Waiting Time for p3 = 27 Average Waiting Time = (0+24+27)/3 = 17 P1 P2 P3 0 24 27 32 Process Burst time P1 24 P2 03 P3 05
  • 8. 2. Shortest-Job-First (SJF) Scheduling:- Till now, we were scheduling the processes according to their arrival time (in FCFS scheduling). However, SJF scheduling algorithm, schedules the processes according to their burst time. In SJF scheduling, the process with the lowest burst time, among the list of available processes in the ready queue, is going to be scheduled next. However, it is very difficult to predict the burst time needed for a process hence this algorithm is very difficult to implement in the system. Advantages of Shortest Job First (SJF):- Maximum throughput. Minimum average waiting and turnaround time. Disadvantages of Shortest Job First (SJF):- May suffer with the problem of starvation It is not implementable because the exact Burst time for a process can't be known in advance.
  • 9. 3. Shortest Remaining Time:- This Algorithm is the preemptive version of SJF scheduling. In SRTF, the execution of the process can be stopped after certain amount of time. At the arrival of every process, the short term scheduler schedules the process with the least remaining burst time among the list of available processes and the running process. Once all the processes are available in the ready queue, No preemption will be done and the algorithm will work as SJF scheduling. The context of the process is saved in the Process Control Block when the process is removed from the execution and the next process is scheduled. This PCB is accessed on the next execution of this process. Advantages of Shortest Remaining Time:- 1)Short-burst jobs run fast Disadvantages of Shortest Remaining Time:- 1) Long-burst (CPU intensive) jobs get a long mean waiting time 2) Rely on ability to estimate CPU burst length
  • 10. 4. Priority Scheduling:- In this tutorial we will understand the priority scheduling algorithm, how it works and its advantages and disadvantages. In the Shortest Job First scheduling algorithm, the priority of a process is generally the inverse of the CPU burst time, i.e. the larger the burst time the lower is the priority of that process. In case of priority scheduling the priority is not always set as the inverse of the CPU burst time, rather it can be internally or externally set, but yes the scheduling is done on the basis of priority of the process where the process which is most urgent is processed first, followed by the ones with lesser priority in order. Processes with same priority are executed in FCFS manner. Advantages of Priority Scheduling:-  The priority of process is selected on the basis of memory requirement, user preference or the requirement of time.  Processes are executed on the basis of priority. So high priority does not need to wait for long which saves time.  It is easy to use.  It is a user friendly algorithm.  Simple to understand.  it has reasonable support for priority.
  • 11. Disadvantages of Priority Scheduling:-  Some low priority processes waiting indefinitely.  A process will be blocked when it is ready to run but has to wait for the CPU because some other process is running currently.  If a new higher priority process keeps on coming in the ready queue, If the system eventually crashes, all low priority processes get lost. If high priority processes take lots of CPU time, then the lower priority processes may starve and will be postponed for an indefinite time
  • 12. 5. Round Robin Scheduling:- The name of this algorithm comes from the round-robin principle, where each person gets an equal share of something in turns. It is the oldest, simplest scheduling algorithm, which is mostly used for multitasking. In Round-robin scheduling, each ready task runs turn by turn only in a cyclic queue for a limited time slice. This algorithm also offers starvation free execution of processes. Advantages of Round Robin algorithm:-  It doesn't face the issues of starvation or convoy effect.  All the jobs get a fair allocation of CPU.  It deals with all process without any priority  If you know the total number of processes on the run queue, then you can also assume the worst-case response time for the same process.  This scheduling method does not depend upon burst time. That's why it is easily implementable on the system.  Once a process is executed for a specific set of the period, the process is preempted, and another process executes for that given time period.
  • 13. Disadvantages of Round Robin algorithm:-  If slicing time of OS is low, the processor output will be reduced.  This method spends more time on context switching  Its performance heavily depends on time quantum.  Priorities cannot be set for the processes.  Round-robin scheduling doesn't give special priority to more important tasks.  Decreases comprehension  Lower time quantum results in higher the context switching overhead in the system.  Finding a correct time quantum is a quite difficult task in this system.
  • 14. 6. Multilevel Queue Scheduling:- It may happen that 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 background (batch) processes. These two classes have different scheduling needs. For this kind of situation Multilevel Queue Scheduling is used . Now, let us see how it works. Ready Queue is divided into separate queues for each class of processes. For example, let us take three different types of process System processes, Interactive processes and Batch Processes. Advantages of Multilevel Queue Scheduling: 1) The processes are permanently assigned to the queue, so it has advantage of low scheduling overhead. Disadvantages of Multilevel Queue Scheduling: 1) Some processes may starve for CPU if some higher priority queues are never becoming empty. It is inflexible in nature.
  • 15. Comparison Between the different CPU Scheduling Algorithm
  • 16. Conclusion 1.Scheduling algorithms should not affect the behavior of the. system (same results regardless of schedule). 2.However, the algorithms do impact the system's efficiency and response time. 3.The best schemes are adaptive. To do absolutely best, we'd have to be able to predict the future.