SlideShare a Scribd company logo
CPU Scheduling Prof.PrasadSawant Lecturer  MCA MACS College Pune Operating System Concepts Prasad Sawant
Alternating Sequence of CPU And I/O Bursts Operating System Concepts Prasad Sawant
CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: 1.	Switches from running to waiting state. 2.	Switches from running to ready state. 3.	Switches from waiting to ready. 4.	Terminates. Scheduling under 1 and 4 is nonpreemptive. All other scheduling is preemptive. Operating System Concepts Prasad Sawant
Dispatcher Dispatcher module gives control of the CPU to the process selected by the short-term scheduler. Operating System Concepts Prasad Sawant
Scheduling Criteria CPU utilization – keep the CPU as busy as possible Throughput– # of processes that complete their execution per time unit Turnaround time – amount of time to execute a particular process Waiting time – amount of time a process has been waiting in the ready queue Operating System Concepts Prasad Sawant
Keep  in mind  Waiting  time (WT)=start time(ST)-Arrival time (AT) Finish time (FT)=start time(ST)+Burst  Time(BT) Total  turn around time(TOT)=Finish time(FT)-Arrival time (AT ) Operating System Concepts Prasad Sawant
Optimization Criteria Max CPU utilization Max throughput Min turnaround time  Min waiting time  Min response time Operating System Concepts Prasad Sawant
First-Come, First-Served (FCFS) Scheduling Operating System Concepts Prasad Sawant Suppose that the processes arrive in the order: P1 , P2 , P3   schedule schedule           0                 10           20                                       30  schedule Waiting time for P1  = 0; P2  = 24; P3 = 27 Average waiting time:  (0 + 24 + 27)/3 = 17 P3  30    P2   27   P1                            24
First-Come, First-Served (FCFS) Scheduling Gantt Chart Operating System Concepts Prasad Sawant Suppose that the processes arrive in the order: P1 , P2 , P3   schedule schedule schedule Waiting time for P1  = 0; P2  = 24; P3 = 27 Average waiting time:  (0 + 24 + 27)/3 = 17 0              P1                                                      24 P2     27 P3     30
Exercise   Find Average waiting time for  Suppose that the processes arrive in the order: P2 , P3 , P1 Operating System Concepts Prasad Sawant
Shortest-Job-First (SJR) Scheduling Associate with each process the length of its next CPU burst.  Use these lengths to schedule the process with the shortest time. Two schemes:  nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst. preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt.  This scheme is know as the Shortest-Remaining-Time-First (SRTF). SJF is optimal – gives minimum average waiting time for a given set of processes. Operating System Concepts Prasad Sawant
Example of Non-Preemptive SJF Operating System Concepts Prasad Sawant schedule schedule schedule schedule 0    P1                                           7 P3      8 P2      12 P4       16 Average waiting time = (0+6+3+7)/4=4
Example of Non-Preemptive SJF Operating System Concepts Prasad Sawant P1                                           7 P3      8 P2      12 P4       16 Average waiting time = (0+6+3+7)/4=4  Average TOT =(7+10+4+11)/4=8
Preemptive SJF Operating System Concepts Prasad Sawant 7 P schedule 10 10-1=9 schedule 1 1-1=0 schedule 17 17-2=15 schedule 5 5-3=2 0 P1             1 P2                        5          P4               10 P1                  17 P3                 26
Priority Scheduling Operating System Concepts Prasad Sawant Schedule   6 6 Schedule   0 0 Schedule   16 16 Schedule   18 18 Schedule   1 1 41/5=8.2 ms 0      P2         1 P5                          6 P1                                             16 P3             18 P4    19 0
SJF Preemptive  Priority Scheduling  Operating System Concepts Prasad Sawant P 5 scheduled 19 19-3=16 scheduled 24 24-1=23 scheduled 12 12-3=9 scheduled 3 3-3=0 48/4=12 ms 0      P1        3  P4                12   P3          19 P1           24 P2             30
Round Robin  Scheduling   Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds.  After this time has elapsed, the process is preempted and added to the end of the ready queue. If there are n processes in the ready queue and the time quantum is q, then each process gets 1/nof the CPU time in chunks of at most q time units at once.  No process waits more than (n-1)q time units. Operating System Concepts Prasad Sawant
Time Quantum and Context Switch Time  Operating System Concepts Prasad Sawant 0 0                                          10 1 6           10 9 2 3 4 5 6 7 8 9 10 1
Round Robin  Time  Quantum 4 Operating System Concepts Prasad Sawant 24-4=20 20-4=16 16-4=12 12-4=8 8-4=4 4-4=0 scheduled 30 scheduled 7 scheduled 10 0    P1  4   P2        7   P3        10   P1        14   P1        18   P1        22   P1        26   P1        30
Questions  Define the difference between pre-emptive and non-pre-emptive scheduling.  Explain the concept of a priority used in scheduling. Why is priority working usually chosen for real time processes? Define by difference between preemptive and non-emptive scheduling. Comment on the principle disadvantage of each of these scheduling methods: FCFS, SJF, RR Operating System Concepts Prasad Sawant
Bibliography  Operating System Principle-Peter Galvin Galvin   Prof.S.G.Lakhdive (Dept .Computer Sci ) Prof.Ramkirshna More A.C.S College Akurdi Mr. AbhishekNagar  Web Administrator at Symbiois Operating System Concepts Prasad Sawant
Thanks  you  Operating System Concepts Prasad Sawant

More Related Content

What's hot

OSCh6
OSCh6OSCh6
Ch5
Ch5Ch5
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
vampugani
 
cpu scheduling in os
cpu scheduling in oscpu scheduling in os
cpu scheduling in os
Kiran Kumar Thota
 
CPU SCHEDULING AND DEADLOCK
CPU SCHEDULING AND	DEADLOCKCPU SCHEDULING AND	DEADLOCK
CPU SCHEDULING AND DEADLOCK
Vicky Kumar
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU Scheduling
Izaz Roghani
 
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinComparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Universitas Pembangunan Panca Budi
 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvin
Shubham Singh
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
Harshit Jain
 
Scheduling
SchedulingScheduling
Scheduling
Mohd Arif
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
Dr. Loganathan R
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
Abhijith Reloaded
 
Round robin scheduling
Round robin schedulingRound robin scheduling
Round robin scheduling
Raghav S
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
Margrat C R
 
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
Anne Lee
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
Shanu Kumar
 
Ch6
Ch6Ch6
Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.
Shreya Kumar
 
Cpu scheduling(suresh)
Cpu scheduling(suresh)Cpu scheduling(suresh)
Cpu scheduling(suresh)
Nagarajan
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
Karthick Sekar
 

What's hot (20)

OSCh6
OSCh6OSCh6
OSCh6
 
Ch5
Ch5Ch5
Ch5
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
cpu scheduling in os
cpu scheduling in oscpu scheduling in os
cpu scheduling in os
 
CPU SCHEDULING AND DEADLOCK
CPU SCHEDULING AND	DEADLOCKCPU SCHEDULING AND	DEADLOCK
CPU SCHEDULING AND DEADLOCK
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU Scheduling
 
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinComparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvin
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
Scheduling
SchedulingScheduling
Scheduling
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Round robin scheduling
Round robin schedulingRound robin scheduling
Round robin scheduling
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
 
Ch6
Ch6Ch6
Ch6
 
Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.
 
Cpu scheduling(suresh)
Cpu scheduling(suresh)Cpu scheduling(suresh)
Cpu scheduling(suresh)
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 

Viewers also liked

Cartesio: la conoscenza
Cartesio: la conoscenzaCartesio: la conoscenza
Cartesio: la conoscenzaritaleuzzi
 
Teatro barroco
Teatro barrocoTeatro barroco
Teatro barroco
Pep Hernández
 
Teatro barroco
Teatro barrocoTeatro barroco
Licei scientifico e linguistico cartesio
Licei scientifico e linguistico cartesioLicei scientifico e linguistico cartesio
Licei scientifico e linguistico cartesio
Licei Classico Linguistico Scientifico "Cartesio"
 
Cartesio
CartesioCartesio
Cartesio
ritaleuzzi
 
1. renato cartesio 1
1. renato cartesio 11. renato cartesio 1
1. renato cartesio 1Elisa2088
 
El teatro barroco la comedia nueva
El teatro barroco la comedia nuevaEl teatro barroco la comedia nueva
El teatro barroco la comedia nueva
Maica Galán Muñoz
 
Teatro barroco
Teatro barrocoTeatro barroco
Teatro barroco
portaldelengua
 
El teatro barroco y la comedia nueva
El teatro barroco y la comedia nuevaEl teatro barroco y la comedia nueva
El teatro barroco y la comedia nueva
maceniebla lenguayliteratura
 
Cartesio
CartesioCartesio
Cartesio
robertnozick
 
El teatro barroco
El teatro barrocoEl teatro barroco
El teatro barroco
Len Estuaria
 
El Teatro Barroco 1ºBach
El Teatro Barroco 1ºBachEl Teatro Barroco 1ºBach
El Teatro Barroco 1ºBach
javilasan
 
EL TEATRO BARROCO
EL TEATRO BARROCOEL TEATRO BARROCO
EL TEATRO BARROCO
David Galindo Sánchez
 
El teatro del Barroco
El teatro del BarrocoEl teatro del Barroco
El teatro del Barroco
Ruth Romero
 
Literatura del Barroco: teatro del Siglo de Oro, lírica y prosa
Literatura del Barroco: teatro del Siglo de Oro, lírica y prosaLiteratura del Barroco: teatro del Siglo de Oro, lírica y prosa
Literatura del Barroco: teatro del Siglo de Oro, lírica y prosa
Pedro Felipe
 
Teatro barroco (I)
Teatro barroco (I)Teatro barroco (I)
Teatro barroco (I)
amm76
 

Viewers also liked (18)

Cartesio: la conoscenza
Cartesio: la conoscenzaCartesio: la conoscenza
Cartesio: la conoscenza
 
La conoscenza
La conoscenzaLa conoscenza
La conoscenza
 
Teatro barroco
Teatro barrocoTeatro barroco
Teatro barroco
 
Teatro barroco
Teatro barrocoTeatro barroco
Teatro barroco
 
Cartesio
CartesioCartesio
Cartesio
 
Licei scientifico e linguistico cartesio
Licei scientifico e linguistico cartesioLicei scientifico e linguistico cartesio
Licei scientifico e linguistico cartesio
 
Cartesio
CartesioCartesio
Cartesio
 
1. renato cartesio 1
1. renato cartesio 11. renato cartesio 1
1. renato cartesio 1
 
El teatro barroco la comedia nueva
El teatro barroco la comedia nuevaEl teatro barroco la comedia nueva
El teatro barroco la comedia nueva
 
Teatro barroco
Teatro barrocoTeatro barroco
Teatro barroco
 
El teatro barroco y la comedia nueva
El teatro barroco y la comedia nuevaEl teatro barroco y la comedia nueva
El teatro barroco y la comedia nueva
 
Cartesio
CartesioCartesio
Cartesio
 
El teatro barroco
El teatro barrocoEl teatro barroco
El teatro barroco
 
El Teatro Barroco 1ºBach
El Teatro Barroco 1ºBachEl Teatro Barroco 1ºBach
El Teatro Barroco 1ºBach
 
EL TEATRO BARROCO
EL TEATRO BARROCOEL TEATRO BARROCO
EL TEATRO BARROCO
 
El teatro del Barroco
El teatro del BarrocoEl teatro del Barroco
El teatro del Barroco
 
Literatura del Barroco: teatro del Siglo de Oro, lírica y prosa
Literatura del Barroco: teatro del Siglo de Oro, lírica y prosaLiteratura del Barroco: teatro del Siglo de Oro, lírica y prosa
Literatura del Barroco: teatro del Siglo de Oro, lírica y prosa
 
Teatro barroco (I)
Teatro barroco (I)Teatro barroco (I)
Teatro barroco (I)
 

Similar to CPU Sheduling

Operating System 5
Operating System 5Operating System 5
Operating System 5
tech2click
 
Ch6
Ch6Ch6
Ch6
C.U
 
Process management in os
Process management in osProcess management in os
Process management in os
Miong Lazaro
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
Dr. Mazin Mohamed alkathiri
 
Operating System Sheduling
Operating System ShedulingOperating System Sheduling
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
Sonali Chauhan
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)
Nagarajan
 
Operating systems - Processes Scheduling
Operating systems - Processes  SchedulingOperating systems - Processes  Scheduling
Operating systems - Processes Scheduling
Chandrakant Divate
 
CH06.pdf
CH06.pdfCH06.pdf
CH06.pdf
ImranKhan880955
 
Os..
Os..Os..
Os..
pri534
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
pri534
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
Chankey Pathak
 
cpu sechduling
cpu sechduling cpu sechduling
cpu sechduling
gopi7
 
Operating system 29 non preemptive scheduling
Operating system 29 non preemptive schedulingOperating system 29 non preemptive scheduling
Operating system 29 non preemptive scheduling
Vaibhav Khanna
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
Vishnu Prasad
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
Ravi Kumar Patel
 
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
Shanmuganathan C
 
Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - Engineering
Yogesh Santhan
 
csc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdfcsc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdf
AkarshNag
 
Distributed Operating System_2
Distributed Operating System_2Distributed Operating System_2
Distributed Operating System_2
Dr Sandeep Kumar Poonia
 

Similar to CPU Sheduling (20)

Operating System 5
Operating System 5Operating System 5
Operating System 5
 
Ch6
Ch6Ch6
Ch6
 
Process management in os
Process management in osProcess management in os
Process management in os
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Operating System Sheduling
Operating System ShedulingOperating System Sheduling
Operating System Sheduling
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)
 
Operating systems - Processes Scheduling
Operating systems - Processes  SchedulingOperating systems - Processes  Scheduling
Operating systems - Processes Scheduling
 
CH06.pdf
CH06.pdfCH06.pdf
CH06.pdf
 
Os..
Os..Os..
Os..
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
cpu sechduling
cpu sechduling cpu sechduling
cpu sechduling
 
Operating system 29 non preemptive scheduling
Operating system 29 non preemptive schedulingOperating system 29 non preemptive scheduling
Operating system 29 non preemptive scheduling
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
 
Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - Engineering
 
csc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdfcsc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdf
 
Distributed Operating System_2
Distributed Operating System_2Distributed Operating System_2
Distributed Operating System_2
 

Recently uploaded

Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 

Recently uploaded (20)

Artificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic WarfareArtificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic Warfare
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 

CPU Sheduling

  • 1. CPU Scheduling Prof.PrasadSawant Lecturer MCA MACS College Pune Operating System Concepts Prasad Sawant
  • 2. Alternating Sequence of CPU And I/O Bursts Operating System Concepts Prasad Sawant
  • 3. CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: 1. Switches from running to waiting state. 2. Switches from running to ready state. 3. Switches from waiting to ready. 4. Terminates. Scheduling under 1 and 4 is nonpreemptive. All other scheduling is preemptive. Operating System Concepts Prasad Sawant
  • 4. Dispatcher Dispatcher module gives control of the CPU to the process selected by the short-term scheduler. Operating System Concepts Prasad Sawant
  • 5. Scheduling Criteria CPU utilization – keep the CPU as busy as possible Throughput– # of processes that complete their execution per time unit Turnaround time – amount of time to execute a particular process Waiting time – amount of time a process has been waiting in the ready queue Operating System Concepts Prasad Sawant
  • 6. Keep in mind Waiting time (WT)=start time(ST)-Arrival time (AT) Finish time (FT)=start time(ST)+Burst Time(BT) Total turn around time(TOT)=Finish time(FT)-Arrival time (AT ) Operating System Concepts Prasad Sawant
  • 7. Optimization Criteria Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time Operating System Concepts Prasad Sawant
  • 8. First-Come, First-Served (FCFS) Scheduling Operating System Concepts Prasad Sawant Suppose that the processes arrive in the order: P1 , P2 , P3 schedule schedule 0 10 20 30 schedule Waiting time for P1 = 0; P2 = 24; P3 = 27 Average waiting time: (0 + 24 + 27)/3 = 17 P3 30 P2 27 P1 24
  • 9. First-Come, First-Served (FCFS) Scheduling Gantt Chart Operating System Concepts Prasad Sawant Suppose that the processes arrive in the order: P1 , P2 , P3 schedule schedule schedule Waiting time for P1 = 0; P2 = 24; P3 = 27 Average waiting time: (0 + 24 + 27)/3 = 17 0 P1 24 P2 27 P3 30
  • 10. Exercise Find Average waiting time for Suppose that the processes arrive in the order: P2 , P3 , P1 Operating System Concepts Prasad Sawant
  • 11. Shortest-Job-First (SJR) Scheduling Associate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time. Two schemes: nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst. preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time-First (SRTF). SJF is optimal – gives minimum average waiting time for a given set of processes. Operating System Concepts Prasad Sawant
  • 12. Example of Non-Preemptive SJF Operating System Concepts Prasad Sawant schedule schedule schedule schedule 0 P1 7 P3 8 P2 12 P4 16 Average waiting time = (0+6+3+7)/4=4
  • 13. Example of Non-Preemptive SJF Operating System Concepts Prasad Sawant P1 7 P3 8 P2 12 P4 16 Average waiting time = (0+6+3+7)/4=4 Average TOT =(7+10+4+11)/4=8
  • 14. Preemptive SJF Operating System Concepts Prasad Sawant 7 P schedule 10 10-1=9 schedule 1 1-1=0 schedule 17 17-2=15 schedule 5 5-3=2 0 P1 1 P2 5 P4 10 P1 17 P3 26
  • 15. Priority Scheduling Operating System Concepts Prasad Sawant Schedule 6 6 Schedule 0 0 Schedule 16 16 Schedule 18 18 Schedule 1 1 41/5=8.2 ms 0 P2 1 P5 6 P1 16 P3 18 P4 19 0
  • 16. SJF Preemptive Priority Scheduling Operating System Concepts Prasad Sawant P 5 scheduled 19 19-3=16 scheduled 24 24-1=23 scheduled 12 12-3=9 scheduled 3 3-3=0 48/4=12 ms 0 P1 3 P4 12 P3 19 P1 24 P2 30
  • 17. Round Robin Scheduling Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. If there are n processes in the ready queue and the time quantum is q, then each process gets 1/nof the CPU time in chunks of at most q time units at once. No process waits more than (n-1)q time units. Operating System Concepts Prasad Sawant
  • 18. Time Quantum and Context Switch Time Operating System Concepts Prasad Sawant 0 0 10 1 6 10 9 2 3 4 5 6 7 8 9 10 1
  • 19. Round Robin Time Quantum 4 Operating System Concepts Prasad Sawant 24-4=20 20-4=16 16-4=12 12-4=8 8-4=4 4-4=0 scheduled 30 scheduled 7 scheduled 10 0 P1 4 P2 7 P3 10 P1 14 P1 18 P1 22 P1 26 P1 30
  • 20. Questions Define the difference between pre-emptive and non-pre-emptive scheduling. Explain the concept of a priority used in scheduling. Why is priority working usually chosen for real time processes? Define by difference between preemptive and non-emptive scheduling. Comment on the principle disadvantage of each of these scheduling methods: FCFS, SJF, RR Operating System Concepts Prasad Sawant
  • 21. Bibliography Operating System Principle-Peter Galvin Galvin Prof.S.G.Lakhdive (Dept .Computer Sci ) Prof.Ramkirshna More A.C.S College Akurdi Mr. AbhishekNagar Web Administrator at Symbiois Operating System Concepts Prasad Sawant
  • 22. Thanks you Operating System Concepts Prasad Sawant