SlideShare uma empresa Scribd logo
1 de 36
Smarter
Scheduling
(Priorities)
Plan for Today
Recap: Scheduling
First Come, First Served / Round-Robin
Priorities
Lottery and Stride Scheduling
Scheduling in Linux
1
Wil Thomason

2
Recap
Main Goals of Scheduling
Maximize Resource Use
Fairness
Switching is Expensive
Fundamental tradeoff between
maximizing usage and fairness
3
Planned vs. On-Demand
Planned: schedule in advance
Supervisor/developer plans schedule given
a priori knowledge about all tasks and deadlines
On-Demand: schedule on-the-fly
Supervisor runs periodically and makes
decision based on current information
Where is planned used?

4
Real-Time Systems
Hard Real-Time
Missing a deadline is a
total system failure.

Soft Real-Time
Undesirable to miss too
many deadlines too badly.

5
Hard Real-Time
Missing a deadline is a
total system failure.

Soft Real-Time
Undesirable to miss too
many deadlines too badly.

6
What must programs be able to do
to have guaranteed schedules?

7
Planned vs. On-Demand
Planned: schedule in advance
Necessary (at least in part)
for hard real time
On-Demand: schedule on-the-fly
Most normal systems have unpredictable
tasks with unknown deadlines
8
What should your courses be?

9
What should your courses be?
Exam 2 will be scheduled later (not next week)
Problem Set 3 is due 11:59pm Wednesday, March 5
Demos on Wednesday, Thursday, Friday
No demos after Spring Break barring snow-out
(firm real-time deadline)
But…if you planned a schedule around the previously posted
deadlines, you can stick to them (see me after class)

10
Scheduling Strategies
First Come, First Served (FIFO)
P1

P2

P3

(effectively: non-preemptive multi-processing)

11
First Come, First Served (FIFO)
P2

P1

P3

(effectively: non-preemptive multi-processing)

Round-Robin
P1

P2

Time Slice

P3

P1

P2

P3

P1

P3

P1

P3

Blocked

Each process gets to run for a set time slice, or until it finished or gets blocked.

12
Comparison
First Come, First Served

Round Robin

13
Which one is my laptop using?

14
Priorities
More important processes: “higher priority”
(except Linux inverts priority values!)
Highest priority = 0
gets most preferential treatment
Lowest priority = 99
highest number varies by Linux flavor
15
High Priority Processes
ps -w -e -o pri,pid,pcpu,vsz,cputime,command
| sort -n -r --key=5 | sort --stable -n --key=1

16
Pre-emptive Priority Scheduling
Always run the highest priority process that is
ready to run
Round-robin schedule among equally high, ready to run,
highest-priority processes
Priority 0:

P 629

Priority 1:

P 44

Memory Read

P 815

P 516

P 131

Network Data

P 528

Priority 2:

Waiting:

P 124

P 221

Shared Bus

P 1209
17
Mars Curiosity (2012)

18
Mars
Pathfinder
(1997)

19
Pathfinder OS: Pre-emptive Priority
Always run the highest priority process that is
ready to run
Round-robin schedule among equally high, ready to
run, highest-priority processes

Actuators

Shared Bus

CPU

Radio
Camera
Flash
Memory
20
Priority Inversion
Task 1 (scheduler) – highest priority (Priority = 1)
Task 2 (send data) – (Priority = 4)
Task 3 (science analysis) – lowest priority (Priority = 97)

Actuators

Shared Bus

CPU

Radio
Camera
Flash
Memory
21
How should we solve
priority inversion?

22
Waiting:

Priority 0:

Priority 1:

P 44
Holds Bus Lock

P 815

P 516

P 131

Network Data

P 528

Priority 2:

Memory Read

P 221

Shared Bus

P 1209

PRI: 0

23
Should my MacBook use a priority pre-emptive scheduler with priority inheritance?

24
Should my MacBook use a priority pre-emptive scheduler with priority inheritance?

25
Kinds of Processes
“Compute-Bound”
P1

“I/O-Bound”
P2

wait for disk…

P2

wait for network…

P2

wait for user…

“Real Time”
P3
need frame ^

P3
need frame ^

P3
need frame ^

P3
need frame ^
26
Carl Waldspurger
27
Lottery Scheduling

28
Lottery Scheduling
• Each user (process) gets a share of the “tickets”
– e.g., 1000 total tickets, 20 processes each get 50 tickets (or
more/less weighted by priority)

• User/process can distribute tickets however it wants
– Among its own threads, can “loan” to other processes’
threads

• Scheduler: randomly picks a ticket
– Associated thread gets to run for that time slice
29
Priority Pre-Emptive

Lottery Scheduling

30
31
32
What is the running time?

33
> uname -a
Linux power2 3.2.0-49-generic #75-Ubuntu SMP Tue Jun 18 17:39:32
UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> sysctl kernel.pid_max
kernel.pid_max = 32768

What is the running time?

34
Charge
Stride scheduling works (in real life also)!
Much smarter than priority pre-emptive (never finish
anything) or first-come first-served or earliest-deadlinefirst. (Unless you like to live serendipitously: then you
should use lottery scheduling)
Problem Set 3 should have high (but not
quite hard real-time) priority! (and try to
turn off interrupts when you work on it!)
35

Mais conteúdo relacionado

Mais procurados

CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithmsShanu Kumar
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling AlgorithmsTayba Farooqui
 
CPU scheduling algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OSharini0810
 
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 RobinUniversitas Pembangunan Panca Budi
 
first come first serve scheduling in os
first come first serve scheduling in os first come first serve scheduling in os
first come first serve scheduling in os mikeemukesh
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithmsPaurav Shah
 
Operating system
Operating systemOperating system
Operating systemLovly Angel
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)Harshit Jain
 
Operating Systems 1 (10/12) - Scheduling
Operating Systems 1 (10/12) - SchedulingOperating Systems 1 (10/12) - Scheduling
Operating Systems 1 (10/12) - SchedulingPeter Tröger
 
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
 
First Come First Serve
First Come First ServeFirst Come First Serve
First Come First ServeKavya Kapoor
 

Mais procurados (20)

Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
CPU scheduling algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OS
 
9 cm402.19
9 cm402.199 cm402.19
9 cm402.19
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process 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
 
first come first serve scheduling in os
first come first serve scheduling in os first come first serve scheduling in os
first come first serve scheduling in os
 
scheduling algorithm
scheduling algorithmscheduling algorithm
scheduling algorithm
 
PPT CPU
PPT CPUPPT CPU
PPT CPU
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
cpu scheduling OS
 cpu scheduling OS cpu scheduling OS
cpu scheduling OS
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Operating system
Operating systemOperating system
Operating system
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
Operating Systems 1 (10/12) - Scheduling
Operating Systems 1 (10/12) - SchedulingOperating Systems 1 (10/12) - Scheduling
Operating Systems 1 (10/12) - Scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
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.
 
First Come First Serve
First Come First ServeFirst Come First Serve
First Come First Serve
 

Semelhante a Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and Stride Scheduling)

UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxansariparveen06
 
Cpu scheduling algorithm on windows
Cpu scheduling algorithm on windowsCpu scheduling algorithm on windows
Cpu scheduling algorithm on windowssiddhartha pande
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System SchedulingVishnu Prasad
 
Smarter Scheduling
Smarter SchedulingSmarter Scheduling
Smarter SchedulingDavid Evans
 
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systemsknowdiff
 
CPU scheduling in Operating System Explanation
CPU scheduling in Operating System ExplanationCPU scheduling in Operating System Explanation
CPU scheduling in Operating System ExplanationAnitaSofiaKeyser
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithmssathish sak
 
dataprocess using different technology.ppt
dataprocess using different technology.pptdataprocess using different technology.ppt
dataprocess using different technology.pptssuserf6eb9b
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Conceptssgpraju
 
Operating System 5
Operating System 5Operating System 5
Operating System 5tech2click
 
3 process scheduling
3 process scheduling3 process scheduling
3 process schedulingahad alam
 

Semelhante a Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and Stride Scheduling) (20)

UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
 
Os2
Os2Os2
Os2
 
Distributed Operating System_2
Distributed Operating System_2Distributed Operating System_2
Distributed Operating System_2
 
Cpu scheduling algorithm on windows
Cpu scheduling algorithm on windowsCpu scheduling algorithm on windows
Cpu scheduling algorithm on windows
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 
Smarter Scheduling
Smarter SchedulingSmarter Scheduling
Smarter Scheduling
 
Section05 scheduling
Section05 schedulingSection05 scheduling
Section05 scheduling
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
 
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
 
Planificacion
PlanificacionPlanificacion
Planificacion
 
Lect07
Lect07Lect07
Lect07
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithms
 
dataprocess using different technology.ppt
dataprocess using different technology.pptdataprocess using different technology.ppt
dataprocess using different technology.ppt
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Concepts
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
 
3 process scheduling
3 process scheduling3 process scheduling
3 process scheduling
 
3_process_scheduling.ppt
3_process_scheduling.ppt3_process_scheduling.ppt
3_process_scheduling.ppt
 

Mais de David Evans

Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!David Evans
 
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksTrick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksDavid Evans
 
Hidden Services, Zero Knowledge
Hidden Services, Zero KnowledgeHidden Services, Zero Knowledge
Hidden Services, Zero KnowledgeDavid Evans
 
Anonymity in Bitcoin
Anonymity in BitcoinAnonymity in Bitcoin
Anonymity in BitcoinDavid Evans
 
Midterm Confirmations
Midterm ConfirmationsMidterm Confirmations
Midterm ConfirmationsDavid Evans
 
Scripting Transactions
Scripting TransactionsScripting Transactions
Scripting TransactionsDavid Evans
 
How to Live in Paradise
How to Live in ParadiseHow to Live in Paradise
How to Live in ParadiseDavid Evans
 
Mining Economics
Mining EconomicsMining Economics
Mining EconomicsDavid Evans
 
Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More ParanoidDavid Evans
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key SignaturesDavid Evans
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to CryptographyDavid Evans
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?David Evans
 
Multi-Party Computation for the Masses
Multi-Party Computation for the MassesMulti-Party Computation for the Masses
Multi-Party Computation for the MassesDavid Evans
 
Proof of Reserve
Proof of ReserveProof of Reserve
Proof of ReserveDavid Evans
 
Blooming Sidechains!
Blooming Sidechains!Blooming Sidechains!
Blooming Sidechains!David Evans
 
Useful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinUseful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinDavid Evans
 

Mais de David Evans (20)

Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!
 
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksTrick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
 
Hidden Services, Zero Knowledge
Hidden Services, Zero KnowledgeHidden Services, Zero Knowledge
Hidden Services, Zero Knowledge
 
Anonymity in Bitcoin
Anonymity in BitcoinAnonymity in Bitcoin
Anonymity in Bitcoin
 
Midterm Confirmations
Midterm ConfirmationsMidterm Confirmations
Midterm Confirmations
 
Scripting Transactions
Scripting TransactionsScripting Transactions
Scripting Transactions
 
How to Live in Paradise
How to Live in ParadiseHow to Live in Paradise
How to Live in Paradise
 
Bitcoin Script
Bitcoin ScriptBitcoin Script
Bitcoin Script
 
Mining Economics
Mining EconomicsMining Economics
Mining Economics
 
Mining
MiningMining
Mining
 
The Blockchain
The BlockchainThe Blockchain
The Blockchain
 
Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More Paranoid
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key Signatures
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?
 
Multi-Party Computation for the Masses
Multi-Party Computation for the MassesMulti-Party Computation for the Masses
Multi-Party Computation for the Masses
 
Proof of Reserve
Proof of ReserveProof of Reserve
Proof of Reserve
 
Silk Road
Silk RoadSilk Road
Silk Road
 
Blooming Sidechains!
Blooming Sidechains!Blooming Sidechains!
Blooming Sidechains!
 
Useful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinUseful Proofs of Work, Permacoin
Useful Proofs of Work, Permacoin
 

Último

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Último (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and Stride Scheduling)

  • 2. Plan for Today Recap: Scheduling First Come, First Served / Round-Robin Priorities Lottery and Stride Scheduling Scheduling in Linux 1
  • 4. Recap Main Goals of Scheduling Maximize Resource Use Fairness Switching is Expensive Fundamental tradeoff between maximizing usage and fairness 3
  • 5. Planned vs. On-Demand Planned: schedule in advance Supervisor/developer plans schedule given a priori knowledge about all tasks and deadlines On-Demand: schedule on-the-fly Supervisor runs periodically and makes decision based on current information Where is planned used? 4
  • 6. Real-Time Systems Hard Real-Time Missing a deadline is a total system failure. Soft Real-Time Undesirable to miss too many deadlines too badly. 5
  • 7. Hard Real-Time Missing a deadline is a total system failure. Soft Real-Time Undesirable to miss too many deadlines too badly. 6
  • 8. What must programs be able to do to have guaranteed schedules? 7
  • 9. Planned vs. On-Demand Planned: schedule in advance Necessary (at least in part) for hard real time On-Demand: schedule on-the-fly Most normal systems have unpredictable tasks with unknown deadlines 8
  • 10. What should your courses be? 9
  • 11. What should your courses be? Exam 2 will be scheduled later (not next week) Problem Set 3 is due 11:59pm Wednesday, March 5 Demos on Wednesday, Thursday, Friday No demos after Spring Break barring snow-out (firm real-time deadline) But…if you planned a schedule around the previously posted deadlines, you can stick to them (see me after class) 10
  • 12. Scheduling Strategies First Come, First Served (FIFO) P1 P2 P3 (effectively: non-preemptive multi-processing) 11
  • 13. First Come, First Served (FIFO) P2 P1 P3 (effectively: non-preemptive multi-processing) Round-Robin P1 P2 Time Slice P3 P1 P2 P3 P1 P3 P1 P3 Blocked Each process gets to run for a set time slice, or until it finished or gets blocked. 12
  • 14. Comparison First Come, First Served Round Robin 13
  • 15. Which one is my laptop using? 14
  • 16. Priorities More important processes: “higher priority” (except Linux inverts priority values!) Highest priority = 0 gets most preferential treatment Lowest priority = 99 highest number varies by Linux flavor 15
  • 17. High Priority Processes ps -w -e -o pri,pid,pcpu,vsz,cputime,command | sort -n -r --key=5 | sort --stable -n --key=1 16
  • 18. Pre-emptive Priority Scheduling Always run the highest priority process that is ready to run Round-robin schedule among equally high, ready to run, highest-priority processes Priority 0: P 629 Priority 1: P 44 Memory Read P 815 P 516 P 131 Network Data P 528 Priority 2: Waiting: P 124 P 221 Shared Bus P 1209 17
  • 21. Pathfinder OS: Pre-emptive Priority Always run the highest priority process that is ready to run Round-robin schedule among equally high, ready to run, highest-priority processes Actuators Shared Bus CPU Radio Camera Flash Memory 20
  • 22. Priority Inversion Task 1 (scheduler) – highest priority (Priority = 1) Task 2 (send data) – (Priority = 4) Task 3 (science analysis) – lowest priority (Priority = 97) Actuators Shared Bus CPU Radio Camera Flash Memory 21
  • 23. How should we solve priority inversion? 22
  • 24. Waiting: Priority 0: Priority 1: P 44 Holds Bus Lock P 815 P 516 P 131 Network Data P 528 Priority 2: Memory Read P 221 Shared Bus P 1209 PRI: 0 23
  • 25. Should my MacBook use a priority pre-emptive scheduler with priority inheritance? 24
  • 26. Should my MacBook use a priority pre-emptive scheduler with priority inheritance? 25
  • 27. Kinds of Processes “Compute-Bound” P1 “I/O-Bound” P2 wait for disk… P2 wait for network… P2 wait for user… “Real Time” P3 need frame ^ P3 need frame ^ P3 need frame ^ P3 need frame ^ 26
  • 30. Lottery Scheduling • Each user (process) gets a share of the “tickets” – e.g., 1000 total tickets, 20 processes each get 50 tickets (or more/less weighted by priority) • User/process can distribute tickets however it wants – Among its own threads, can “loan” to other processes’ threads • Scheduler: randomly picks a ticket – Associated thread gets to run for that time slice 29
  • 32. 31
  • 33. 32
  • 34. What is the running time? 33
  • 35. > uname -a Linux power2 3.2.0-49-generic #75-Ubuntu SMP Tue Jun 18 17:39:32 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux > sysctl kernel.pid_max kernel.pid_max = 32768 What is the running time? 34
  • 36. Charge Stride scheduling works (in real life also)! Much smarter than priority pre-emptive (never finish anything) or first-come first-served or earliest-deadlinefirst. (Unless you like to live serendipitously: then you should use lottery scheduling) Problem Set 3 should have high (but not quite hard real-time) priority! (and try to turn off interrupts when you work on it!) 35