SlideShare a Scribd company logo
Chapter 6
1
CPU Scheduling
Chapter 6
2
Classification of Scheduling Activity
 Long-term: which process to admit
 Medium-term: which process to swap in or out
 Short-term: which ready process to execute next
3
Long-Term Scheduling
 Determines which programs are admitted
to the system for processing
 Controls the degree of multiprogramming
 If more processes are admitted
• less likely that all processes will be blocked
• better CPU usage
• each process has smaller fraction of the CPU
 The long term scheduler may attempt to
keep a mix of processor-bound and I/O-
bound processes
4
Medium-Term Scheduling
 Swapping decisions based on the need to
manage multiprogramming
• Allows the long-term scheduler to admit more
processes than actually fit in memory
• but too many processes can increase disk
activity (paging), so there is some “optimum”
level of multiprogramming.
 Done by memory management software
(chapter 8)
5
Short-Term Scheduling
 Determines which process is going to execute
next (also called CPU scheduling)
 the focus of this chapter..
 invoked on a event that may lead to choosing
another process for execution:
• clock interrupts
• I/O interrupts
• operating system calls and traps, including I/O
• signals
6
The CPU-I/O Cycle
Silberschatz, Galvin, and Gagne 1999
“CPU-bound”
processes require
more CPU time than
I/O time
“I/O-bound”
processes spend
most of their time
waiting for I/O.
7
Histogram of CPU-burst Times
Silberschatz, Galvin, and Gagne 1999
8
Our focus
 Uniprocessor Scheduling: scheduling a
single CPU among all the processes in the
system
 Key Criteria:
• Maximize CPU utilization
• Maximize throughput
• Minimize waiting times
• Minimize response time
• Minimize turnaround time
9
Criteria
 Maximize CPU utilization
• Efficiency
• Need to keep the CPU busy
 Minimize waiting times
• Time spent waiting in READY queue
• Each process should get a fair share of the
CPU
10
Criteria
 Maximize throughput
• Process completions per time unit
 Minimize response time
• From a user request to the first response
• I/O bound processes
 Minimize turnaround time
• CPU-bound process equivalent of response
time
• Elapsed time to complete a process
11
User vs. System Scheduling Criteria
User-oriented
 Turnaround Time (batch systems): Elapsed time
from the submission of a process to its
completion
 Response Time (interactive systems): Elapsed
time from the submission of a request to the first
response
System-oriented
 CPU utilization
 fairness
 throughput: processes completed per unit time
12
Two Components of Scheduling Policies
Selection function
 which process in the ready queue is selected next
for execution?
Decision mode
 at what times is the selection function exercised?
• Nonpreemptive
 A process in the running state runs until it blocks or
ends
• Preemptive
 Currently running process may be interrupted and
moved to the Ready state by the OS
 Prevents any one process from monopolizing the
CPU
13
Policy vs. Mechanism
 Important in scheduling and resource
allocation algorithms
 Policy
• What is to be done
 Mechanism
• How to do it
 Policy: All users equal access
 Mechanism: round robin scheduling
 Policy: Paid jobs get higher priority
 Mechanism: Preemptive scheduling
algorithm
14
A running example to discuss various
scheduling policies
Process
Arrival
Time
Burst
Time
1
2
3
4
5
0
2
4
6
8
3
6
4
5
2
15
First Come First Served (FCFS)
 Selection function: the process that has
been waiting the longest in the ready
queue (hence, FCFS, FIFO queue)
 Decision mode: nonpreemptive
• a process runs until it blocks itself (I/O or other)
16
FCFS Drawbacks
 Favors CPU-bound processes
• A process that does not perform any I/O will
monopolize the processor!
• I/O-bound processes have to wait until CPU-
bound process completes
• They may have to wait even when their I/Os
have completed
 poor device utilization
• We could reduce the average wait time by
giving more priority to I/O bound processes
17
Shortest Job First (SJF)
 Selection function: the process with the shortest
expected CPU burst time
 Decision mode: non-preemptive
 I/O bound processes will be picked first
 We need to estimate the expected CPU burst time
for each process: on the basis of past behavior.
Shortest job
First (SJF)
18
Estimating the Required CPU Burst
 Can average all past history equally
 But recent history of a process is more likely
to reflect future behavior
 A common technique for that is to use
exponential averaging
• S[n+1] = a T[n] + (1-a) S[n] ; 0 < a < 1
• Puts more weight on recent instances
whenever a > 1/n
19
Exponentially Decreasing Coefficients
20
Exponential Averaging
 Set S[1] = 0 to give new processes high priority.
 Exponential averaging tracks changes in process
behavior much faster than simple averaging.
21
Shortest Job First: Critique
 SJF implicitly incorporates priorities: shortest
jobs are given preference.
• Typically these are I/O bound jobs
 Longer processes can starve if there is a
steady supply of shorter processes
 Lack of preemption not suitable in a time
sharing environment
• CPU bound process gets lower priority
• But a process doing no I/O at all could
monopolize the CPU if it is the first one in the
system
22
Shortest Remaining Time (SRT) =
Preemptive SJF
 If a process arrives in the Ready queue
with estimated CPU burst less than
remaining time of the currently running
process, preempt.
 Prevents long jobs from dominating.
• But must keep track of remaining burst
times
 Better turnaround time than SJF
• Short jobs get immediate preference
23
 Selection function: same as FCFS
 Decision mode: Preemptive
• Maximum time slice (typically 10 - 100 ms)
enforced by timer interrupt
• running process is put at the tail of the ready
queue
Round-Robin
24
Time Quantum for Round Robin
 must be substantially larger than process switch time
 should be larger than the typical CPU burst
 If too large, degenerates to FCFS
 Too small, excessive context switches (overhead)
25
Fairness vs. Efficiency
 Each context switch has the OS using the
CPU instead of the user process
• give up CPU, save all info, reload w/ status of
incoming process
• Say 20 ms quantum length, 5 ms context switch
• Waste of resources
 20% of CPU time (5/20) for context switch
• If 500 ms quantum, better use of resources
 1% of CPU time (5/500) for context switch
 Bad if lots of users in system – interactive users
waiting for CPU
• Balance found depends on job mix
26
Round Robin: Critique
 Still favors CPU-bound processes
• An I/O bound process uses the CPU for a time less than
the time quantum and then is blocked waiting for I/O
• A CPU-bound process runs for its whole time slice and
goes back into the ready queue (in front of the blocked
processes)
 One solution: virtual round robin (VRR, not in
book…)
• When a I/O has completed, the blocked process is
moved to an auxiliary queue which gets preference over
the main ready queue
• A process dispatched from the auxiliary queue gets a
shorter time quantum (what is “left over” from its
quantum when it was last selected from the ready
queue)
Ad

More Related Content

Similar to pscheduling.ppt (20)

Lecture 3 CPU scheduling.pdfvgukgiolphpiphjp
Lecture 3 CPU scheduling.pdfvgukgiolphpiphjpLecture 3 CPU scheduling.pdfvgukgiolphpiphjp
Lecture 3 CPU scheduling.pdfvgukgiolphpiphjp
MohamedPalastine
 
topic cpu scheduling in operating system.pptx
topic cpu scheduling in operating system.pptxtopic cpu scheduling in operating system.pptx
topic cpu scheduling in operating system.pptx
iotsaprofessor
 
Scheduling.ppt with operating system slides
Scheduling.ppt with operating system slidesScheduling.ppt with operating system slides
Scheduling.ppt with operating system slides
lovepreet33653
 
Lecture 4 process cpu scheduling
Lecture 4   process cpu schedulingLecture 4   process cpu scheduling
Lecture 4 process cpu scheduling
Kumbirai Junior Muzavazi
 
3Chapter Three- CPU Scheduling this is the best.pptx
3Chapter Three- CPU Scheduling this is the best.pptx3Chapter Three- CPU Scheduling this is the best.pptx
3Chapter Three- CPU Scheduling this is the best.pptx
habtegebeyawu
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
amadayshwan
 
CPU scheduling in Operating System Explanation
CPU scheduling in Operating System ExplanationCPU scheduling in Operating System Explanation
CPU scheduling in Operating System Explanation
AnitaSofiaKeyser
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
manideepakc
 
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 ALGORITHMS-FCFS,SJF,RR.pptx
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptxCPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
Rajapriya82
 
Chapter No 4 CPU Scheduling and Algorithms.ppt
Chapter No 4 CPU Scheduling and Algorithms.pptChapter No 4 CPU Scheduling and Algorithms.ppt
Chapter No 4 CPU Scheduling and Algorithms.ppt
rajaghogre22
 
Scheduling Definition, objectives and types
Scheduling Definition, objectives and types Scheduling Definition, objectives and types
Scheduling Definition, objectives and types
Maitree Patel
 
Process Scheduling in operating systems.pptx
Process Scheduling in operating systems.pptxProcess Scheduling in operating systems.pptx
Process Scheduling in operating systems.pptx
notabookworm
 
Scheduling
SchedulingScheduling
Scheduling
pradeepa velmurugan
 
DISEÑO DE MEMORIA EN SISTEMAS DE INFORMACION DIGITALES
DISEÑO DE MEMORIA EN SISTEMAS DE INFORMACION DIGITALESDISEÑO DE MEMORIA EN SISTEMAS DE INFORMACION DIGITALES
DISEÑO DE MEMORIA EN SISTEMAS DE INFORMACION DIGITALES
2021207019est
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
Mukesh Chinta
 
CPU Scheduling.pptx
CPU Scheduling.pptxCPU Scheduling.pptx
CPU Scheduling.pptx
yashu23
 
Operating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingOperating system 28 fundamental of scheduling
Operating system 28 fundamental of scheduling
Vaibhav Khanna
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
KeyreSebre
 
CPU Scheduling_in_processManagement.pptx
CPU Scheduling_in_processManagement.pptxCPU Scheduling_in_processManagement.pptx
CPU Scheduling_in_processManagement.pptx
ezekielnyamu1
 
Lecture 3 CPU scheduling.pdfvgukgiolphpiphjp
Lecture 3 CPU scheduling.pdfvgukgiolphpiphjpLecture 3 CPU scheduling.pdfvgukgiolphpiphjp
Lecture 3 CPU scheduling.pdfvgukgiolphpiphjp
MohamedPalastine
 
topic cpu scheduling in operating system.pptx
topic cpu scheduling in operating system.pptxtopic cpu scheduling in operating system.pptx
topic cpu scheduling in operating system.pptx
iotsaprofessor
 
Scheduling.ppt with operating system slides
Scheduling.ppt with operating system slidesScheduling.ppt with operating system slides
Scheduling.ppt with operating system slides
lovepreet33653
 
3Chapter Three- CPU Scheduling this is the best.pptx
3Chapter Three- CPU Scheduling this is the best.pptx3Chapter Three- CPU Scheduling this is the best.pptx
3Chapter Three- CPU Scheduling this is the best.pptx
habtegebeyawu
 
CPU scheduling in Operating System Explanation
CPU scheduling in Operating System ExplanationCPU scheduling in Operating System Explanation
CPU scheduling in Operating System Explanation
AnitaSofiaKeyser
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
manideepakc
 
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 ALGORITHMS-FCFS,SJF,RR.pptx
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptxCPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
Rajapriya82
 
Chapter No 4 CPU Scheduling and Algorithms.ppt
Chapter No 4 CPU Scheduling and Algorithms.pptChapter No 4 CPU Scheduling and Algorithms.ppt
Chapter No 4 CPU Scheduling and Algorithms.ppt
rajaghogre22
 
Scheduling Definition, objectives and types
Scheduling Definition, objectives and types Scheduling Definition, objectives and types
Scheduling Definition, objectives and types
Maitree Patel
 
Process Scheduling in operating systems.pptx
Process Scheduling in operating systems.pptxProcess Scheduling in operating systems.pptx
Process Scheduling in operating systems.pptx
notabookworm
 
DISEÑO DE MEMORIA EN SISTEMAS DE INFORMACION DIGITALES
DISEÑO DE MEMORIA EN SISTEMAS DE INFORMACION DIGITALESDISEÑO DE MEMORIA EN SISTEMAS DE INFORMACION DIGITALES
DISEÑO DE MEMORIA EN SISTEMAS DE INFORMACION DIGITALES
2021207019est
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
Mukesh Chinta
 
CPU Scheduling.pptx
CPU Scheduling.pptxCPU Scheduling.pptx
CPU Scheduling.pptx
yashu23
 
Operating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingOperating system 28 fundamental of scheduling
Operating system 28 fundamental of scheduling
Vaibhav Khanna
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
KeyreSebre
 
CPU Scheduling_in_processManagement.pptx
CPU Scheduling_in_processManagement.pptxCPU Scheduling_in_processManagement.pptx
CPU Scheduling_in_processManagement.pptx
ezekielnyamu1
 

More from ansariparveen06 (20)

Preprocessing of data mining process.ppt
Preprocessing of data mining process.pptPreprocessing of data mining process.ppt
Preprocessing of data mining process.ppt
ansariparveen06
 
8. Ozone and Environmental issue and solution.ppt
8. Ozone and Environmental issue and solution.ppt8. Ozone and Environmental issue and solution.ppt
8. Ozone and Environmental issue and solution.ppt
ansariparveen06
 
ALP intro assembly language programing.pptx
ALP intro assembly language programing.pptxALP intro assembly language programing.pptx
ALP intro assembly language programing.pptx
ansariparveen06
 
cpphtp9_Exception handling in c++ .ppt
cpphtp9_Exception handling in c++   .pptcpphtp9_Exception handling in c++   .ppt
cpphtp9_Exception handling in c++ .ppt
ansariparveen06
 
introduction to javascript concepts .ppt
introduction to javascript concepts .pptintroduction to javascript concepts .ppt
introduction to javascript concepts .ppt
ansariparveen06
 
java multi threading and synchronisation.ppt
java multi threading and synchronisation.pptjava multi threading and synchronisation.ppt
java multi threading and synchronisation.ppt
ansariparveen06
 
Environmental studies part2 bscit sem2.pptx
Environmental studies part2 bscit sem2.pptxEnvironmental studies part2 bscit sem2.pptx
Environmental studies part2 bscit sem2.pptx
ansariparveen06
 
ENVIRONMENTAL STUDIES FYBSCIT SEM 2.pptx
ENVIRONMENTAL STUDIES FYBSCIT SEM 2.pptxENVIRONMENTAL STUDIES FYBSCIT SEM 2.pptx
ENVIRONMENTAL STUDIES FYBSCIT SEM 2.pptx
ansariparveen06
 
exception-handling-in-java programming.ppt
exception-handling-in-java programming.pptexception-handling-in-java programming.ppt
exception-handling-in-java programming.ppt
ansariparveen06
 
brief introduction to core java programming.pptx
brief introduction to core java programming.pptxbrief introduction to core java programming.pptx
brief introduction to core java programming.pptx
ansariparveen06
 
Module1 evs Environmental Pollution.pptx
Module1 evs Environmental Pollution.pptxModule1 evs Environmental Pollution.pptx
Module1 evs Environmental Pollution.pptx
ansariparveen06
 
Internet_Banking e commerce in banking.pptx
Internet_Banking e commerce in banking.pptxInternet_Banking e commerce in banking.pptx
Internet_Banking e commerce in banking.pptx
ansariparveen06
 
UNIT1 Decision Support System in BI.pptx
UNIT1 Decision Support System in BI.pptxUNIT1 Decision Support System in BI.pptx
UNIT1 Decision Support System in BI.pptx
ansariparveen06
 
logic gate based on discrete mathematics.ppt
logic gate based on discrete mathematics.pptlogic gate based on discrete mathematics.ppt
logic gate based on discrete mathematics.ppt
ansariparveen06
 
Overview on how to Disciplining in life .pptx
Overview on how to Disciplining in life .pptxOverview on how to Disciplining in life .pptx
Overview on how to Disciplining in life .pptx
ansariparveen06
 
presentation on java server pages vs servlet.ppt
presentation on java server pages vs servlet.pptpresentation on java server pages vs servlet.ppt
presentation on java server pages vs servlet.ppt
ansariparveen06
 
Introduction to Java Servlets and JSP (1).ppt
Introduction to Java Servlets and JSP (1).pptIntroduction to Java Servlets and JSP (1).ppt
Introduction to Java Servlets and JSP (1).ppt
ansariparveen06
 
enterprise java - introduction to servlet.pptx
enterprise java - introduction to servlet.pptxenterprise java - introduction to servlet.pptx
enterprise java - introduction to servlet.pptx
ansariparveen06
 
Introduction to Operating - Systems.pptx
Introduction to Operating - Systems.pptxIntroduction to Operating - Systems.pptx
Introduction to Operating - Systems.pptx
ansariparveen06
 
Advanced Web Programming_UNIT_1_NewSyllabus.pdf
Advanced Web Programming_UNIT_1_NewSyllabus.pdfAdvanced Web Programming_UNIT_1_NewSyllabus.pdf
Advanced Web Programming_UNIT_1_NewSyllabus.pdf
ansariparveen06
 
Preprocessing of data mining process.ppt
Preprocessing of data mining process.pptPreprocessing of data mining process.ppt
Preprocessing of data mining process.ppt
ansariparveen06
 
8. Ozone and Environmental issue and solution.ppt
8. Ozone and Environmental issue and solution.ppt8. Ozone and Environmental issue and solution.ppt
8. Ozone and Environmental issue and solution.ppt
ansariparveen06
 
ALP intro assembly language programing.pptx
ALP intro assembly language programing.pptxALP intro assembly language programing.pptx
ALP intro assembly language programing.pptx
ansariparveen06
 
cpphtp9_Exception handling in c++ .ppt
cpphtp9_Exception handling in c++   .pptcpphtp9_Exception handling in c++   .ppt
cpphtp9_Exception handling in c++ .ppt
ansariparveen06
 
introduction to javascript concepts .ppt
introduction to javascript concepts .pptintroduction to javascript concepts .ppt
introduction to javascript concepts .ppt
ansariparveen06
 
java multi threading and synchronisation.ppt
java multi threading and synchronisation.pptjava multi threading and synchronisation.ppt
java multi threading and synchronisation.ppt
ansariparveen06
 
Environmental studies part2 bscit sem2.pptx
Environmental studies part2 bscit sem2.pptxEnvironmental studies part2 bscit sem2.pptx
Environmental studies part2 bscit sem2.pptx
ansariparveen06
 
ENVIRONMENTAL STUDIES FYBSCIT SEM 2.pptx
ENVIRONMENTAL STUDIES FYBSCIT SEM 2.pptxENVIRONMENTAL STUDIES FYBSCIT SEM 2.pptx
ENVIRONMENTAL STUDIES FYBSCIT SEM 2.pptx
ansariparveen06
 
exception-handling-in-java programming.ppt
exception-handling-in-java programming.pptexception-handling-in-java programming.ppt
exception-handling-in-java programming.ppt
ansariparveen06
 
brief introduction to core java programming.pptx
brief introduction to core java programming.pptxbrief introduction to core java programming.pptx
brief introduction to core java programming.pptx
ansariparveen06
 
Module1 evs Environmental Pollution.pptx
Module1 evs Environmental Pollution.pptxModule1 evs Environmental Pollution.pptx
Module1 evs Environmental Pollution.pptx
ansariparveen06
 
Internet_Banking e commerce in banking.pptx
Internet_Banking e commerce in banking.pptxInternet_Banking e commerce in banking.pptx
Internet_Banking e commerce in banking.pptx
ansariparveen06
 
UNIT1 Decision Support System in BI.pptx
UNIT1 Decision Support System in BI.pptxUNIT1 Decision Support System in BI.pptx
UNIT1 Decision Support System in BI.pptx
ansariparveen06
 
logic gate based on discrete mathematics.ppt
logic gate based on discrete mathematics.pptlogic gate based on discrete mathematics.ppt
logic gate based on discrete mathematics.ppt
ansariparveen06
 
Overview on how to Disciplining in life .pptx
Overview on how to Disciplining in life .pptxOverview on how to Disciplining in life .pptx
Overview on how to Disciplining in life .pptx
ansariparveen06
 
presentation on java server pages vs servlet.ppt
presentation on java server pages vs servlet.pptpresentation on java server pages vs servlet.ppt
presentation on java server pages vs servlet.ppt
ansariparveen06
 
Introduction to Java Servlets and JSP (1).ppt
Introduction to Java Servlets and JSP (1).pptIntroduction to Java Servlets and JSP (1).ppt
Introduction to Java Servlets and JSP (1).ppt
ansariparveen06
 
enterprise java - introduction to servlet.pptx
enterprise java - introduction to servlet.pptxenterprise java - introduction to servlet.pptx
enterprise java - introduction to servlet.pptx
ansariparveen06
 
Introduction to Operating - Systems.pptx
Introduction to Operating - Systems.pptxIntroduction to Operating - Systems.pptx
Introduction to Operating - Systems.pptx
ansariparveen06
 
Advanced Web Programming_UNIT_1_NewSyllabus.pdf
Advanced Web Programming_UNIT_1_NewSyllabus.pdfAdvanced Web Programming_UNIT_1_NewSyllabus.pdf
Advanced Web Programming_UNIT_1_NewSyllabus.pdf
ansariparveen06
 
Ad

Recently uploaded (20)

The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Ad

pscheduling.ppt

  • 2. 2 Classification of Scheduling Activity  Long-term: which process to admit  Medium-term: which process to swap in or out  Short-term: which ready process to execute next
  • 3. 3 Long-Term Scheduling  Determines which programs are admitted to the system for processing  Controls the degree of multiprogramming  If more processes are admitted • less likely that all processes will be blocked • better CPU usage • each process has smaller fraction of the CPU  The long term scheduler may attempt to keep a mix of processor-bound and I/O- bound processes
  • 4. 4 Medium-Term Scheduling  Swapping decisions based on the need to manage multiprogramming • Allows the long-term scheduler to admit more processes than actually fit in memory • but too many processes can increase disk activity (paging), so there is some “optimum” level of multiprogramming.  Done by memory management software (chapter 8)
  • 5. 5 Short-Term Scheduling  Determines which process is going to execute next (also called CPU scheduling)  the focus of this chapter..  invoked on a event that may lead to choosing another process for execution: • clock interrupts • I/O interrupts • operating system calls and traps, including I/O • signals
  • 6. 6 The CPU-I/O Cycle Silberschatz, Galvin, and Gagne 1999 “CPU-bound” processes require more CPU time than I/O time “I/O-bound” processes spend most of their time waiting for I/O.
  • 7. 7 Histogram of CPU-burst Times Silberschatz, Galvin, and Gagne 1999
  • 8. 8 Our focus  Uniprocessor Scheduling: scheduling a single CPU among all the processes in the system  Key Criteria: • Maximize CPU utilization • Maximize throughput • Minimize waiting times • Minimize response time • Minimize turnaround time
  • 9. 9 Criteria  Maximize CPU utilization • Efficiency • Need to keep the CPU busy  Minimize waiting times • Time spent waiting in READY queue • Each process should get a fair share of the CPU
  • 10. 10 Criteria  Maximize throughput • Process completions per time unit  Minimize response time • From a user request to the first response • I/O bound processes  Minimize turnaround time • CPU-bound process equivalent of response time • Elapsed time to complete a process
  • 11. 11 User vs. System Scheduling Criteria User-oriented  Turnaround Time (batch systems): Elapsed time from the submission of a process to its completion  Response Time (interactive systems): Elapsed time from the submission of a request to the first response System-oriented  CPU utilization  fairness  throughput: processes completed per unit time
  • 12. 12 Two Components of Scheduling Policies Selection function  which process in the ready queue is selected next for execution? Decision mode  at what times is the selection function exercised? • Nonpreemptive  A process in the running state runs until it blocks or ends • Preemptive  Currently running process may be interrupted and moved to the Ready state by the OS  Prevents any one process from monopolizing the CPU
  • 13. 13 Policy vs. Mechanism  Important in scheduling and resource allocation algorithms  Policy • What is to be done  Mechanism • How to do it  Policy: All users equal access  Mechanism: round robin scheduling  Policy: Paid jobs get higher priority  Mechanism: Preemptive scheduling algorithm
  • 14. 14 A running example to discuss various scheduling policies Process Arrival Time Burst Time 1 2 3 4 5 0 2 4 6 8 3 6 4 5 2
  • 15. 15 First Come First Served (FCFS)  Selection function: the process that has been waiting the longest in the ready queue (hence, FCFS, FIFO queue)  Decision mode: nonpreemptive • a process runs until it blocks itself (I/O or other)
  • 16. 16 FCFS Drawbacks  Favors CPU-bound processes • A process that does not perform any I/O will monopolize the processor! • I/O-bound processes have to wait until CPU- bound process completes • They may have to wait even when their I/Os have completed  poor device utilization • We could reduce the average wait time by giving more priority to I/O bound processes
  • 17. 17 Shortest Job First (SJF)  Selection function: the process with the shortest expected CPU burst time  Decision mode: non-preemptive  I/O bound processes will be picked first  We need to estimate the expected CPU burst time for each process: on the basis of past behavior. Shortest job First (SJF)
  • 18. 18 Estimating the Required CPU Burst  Can average all past history equally  But recent history of a process is more likely to reflect future behavior  A common technique for that is to use exponential averaging • S[n+1] = a T[n] + (1-a) S[n] ; 0 < a < 1 • Puts more weight on recent instances whenever a > 1/n
  • 20. 20 Exponential Averaging  Set S[1] = 0 to give new processes high priority.  Exponential averaging tracks changes in process behavior much faster than simple averaging.
  • 21. 21 Shortest Job First: Critique  SJF implicitly incorporates priorities: shortest jobs are given preference. • Typically these are I/O bound jobs  Longer processes can starve if there is a steady supply of shorter processes  Lack of preemption not suitable in a time sharing environment • CPU bound process gets lower priority • But a process doing no I/O at all could monopolize the CPU if it is the first one in the system
  • 22. 22 Shortest Remaining Time (SRT) = Preemptive SJF  If a process arrives in the Ready queue with estimated CPU burst less than remaining time of the currently running process, preempt.  Prevents long jobs from dominating. • But must keep track of remaining burst times  Better turnaround time than SJF • Short jobs get immediate preference
  • 23. 23  Selection function: same as FCFS  Decision mode: Preemptive • Maximum time slice (typically 10 - 100 ms) enforced by timer interrupt • running process is put at the tail of the ready queue Round-Robin
  • 24. 24 Time Quantum for Round Robin  must be substantially larger than process switch time  should be larger than the typical CPU burst  If too large, degenerates to FCFS  Too small, excessive context switches (overhead)
  • 25. 25 Fairness vs. Efficiency  Each context switch has the OS using the CPU instead of the user process • give up CPU, save all info, reload w/ status of incoming process • Say 20 ms quantum length, 5 ms context switch • Waste of resources  20% of CPU time (5/20) for context switch • If 500 ms quantum, better use of resources  1% of CPU time (5/500) for context switch  Bad if lots of users in system – interactive users waiting for CPU • Balance found depends on job mix
  • 26. 26 Round Robin: Critique  Still favors CPU-bound processes • An I/O bound process uses the CPU for a time less than the time quantum and then is blocked waiting for I/O • A CPU-bound process runs for its whole time slice and goes back into the ready queue (in front of the blocked processes)  One solution: virtual round robin (VRR, not in book…) • When a I/O has completed, the blocked process is moved to an auxiliary queue which gets preference over the main ready queue • A process dispatched from the auxiliary queue gets a shorter time quantum (what is “left over” from its quantum when it was last selected from the ready queue)