cpu reservations and time constraints: efficient, predictable scheduling of independent activities...
TRANSCRIPT
![Page 1: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/1.jpg)
CPU Reservations and Time Constraints:CPU Reservations and Time Constraints:Efficient, Predictable Scheduling of Efficient, Predictable Scheduling of
Independent ActivitiesIndependent Activities
Michael B. Jones, Microsoft Research
Daniela Roşu, Georgia Tech
Marcel-Cătălin Roşu, Georgia Tech
![Page 2: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/2.jpg)
Goal: Coexisting Independent Goal: Coexisting Independent Real-time ApplicationsReal-time Applications
Independently developed Predictable concurrent execution of
real-time and non-real-time apps
Meeting all apps’ timing needs Informing apps when not possible
![Page 3: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/3.jpg)
Teaser CapabilityTeaser Capability Apps can ask scheduler:
“Can I do 5ms of work betweennow+30ms and now+40ms?”
Scheduler answers either: “I guarantee it” or “You probably can’t”
Guaranteeing this 5ms work in future 10ms interval does not require reserving 50% of CPU for next 40ms
![Page 4: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/4.jpg)
How did we do it?How did we do it?
Explicitly represent future time Map app declarations of timing
needs into grants of future time
Enables: Advance guarantees to applications, or Denial of requests up front
![Page 5: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/5.jpg)
Scheduling of Independently Scheduling of Independently Authored ApplicationsAuthored Applications
System support for adaptive apps Apps requests based only on their
local properties No inter-app coordination needed As opposed to priorities
Guarantees hold independent of other activities’ behavior
![Page 6: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/6.jpg)
Research ContextResearch Context
Rialto real-time operating system Research version of ITV kernel
Microsoft Interactive TV system Commercial trial in Yokosuka, Japan
Tiger Video Fileserver
![Page 7: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/7.jpg)
OutlineOutline
Research Goals
Programming ModelScheduling Architecture
How much does it cost?
What can it do?
Conclusions
![Page 8: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/8.jpg)
Programming ModelProgramming Model
Activities CPU Reservations Time Constraints
![Page 9: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/9.jpg)
Abstraction: ActivityAbstraction: Activity
Resources allocated to, charged against Each application typically a distinct
activity Each thread belongs to an activity
Threads within activity assumed to cooperate
Rialto kernel also uses activities
![Page 10: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/10.jpg)
Abstraction: CPU ReservationAbstraction: CPU Reservation
Guaranteed execution rate and granularity for an activity X units of time out of every Y units, e.g.
800µs every 5ms 7.5ms every 33.3ms one second every minute
Continuously guaranteed
![Page 11: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/11.jpg)
Sensitivity to Reservation Sensitivity to Reservation Amount Amount andand Period Period
0%10%20%30%40%50%60%70%80%90%
100%
0 10 20 30 40 50 60
Reservation Period (ms)
% F
ram
es R
ende
red
20% Res 15% Res 10% Res
AVI player, 89% combined reservations for player and background load activity
![Page 12: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/12.jpg)
Abstraction: Time ConstraintAbstraction: Time Constraint
Deadline-based thread execution Guarantees execution within interval, or Proactively denies constraint request
schedulable = BeginConstraint (time_interval, estimate);if (schedulable) then
Do normal work under constraintelse
Transient overload -- shed load if possibletime_taken = EndConstraint ();
![Page 13: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/13.jpg)
Example: CPU Reservation &Example: CPU Reservation &Time ConstraintsTime Constraints
Activities: Estimate:
Time
Time
with reservations
with reservationsand constraints
Start Time: Deadline:
![Page 14: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/14.jpg)
Example: Time Constraints & Example: Time Constraints & nono CPU Reservations CPU Reservations
Activities: Estimate:
Time
Time
with reservations
Start Time: Deadline:
with reservationsand constraints
![Page 15: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/15.jpg)
Related WorkRelated WorkTwo classes of related work Those using virtual time
Goyal et al., Stoica et al., Mercer et al., Nieh & Lam
Those using real time Schwan & Zhou, Maruti project at UMD
Our system Uses compact representation of real time:
Precomputed Scheduling Plan
![Page 16: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/16.jpg)
OutlineOutline
Research Goals
Programming Model
Scheduling ArchitectureHow much does it cost?
What can it do?
Conclusions
![Page 17: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/17.jpg)
Key InsightKey Insight
Precomputed Scheduling Plan Allocation of future time intervals to
Activities: for CPU Reservations Threads: for Time Constraints
Enables efficient: Scheduling decisions Feasibility analysis for constraints Guarantees for reservations, constraints
![Page 18: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/18.jpg)
Scheduling Plan ExampleScheduling Plan Example
Activity A B C D E FAmount 4ms 3ms 2ms 1ms 1ms 5msPeriod 20ms 10ms 40ms 20ms 10ms 40ms
3: B 1: E
4: A 2: free
1: D
3: free2: C
5: F
![Page 19: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/19.jpg)
Scheduling Graph ConstructionScheduling Graph Construction
Occurs only when reservations change Goals
Minimize context switches Maximize execution intervals Distribute free nodes evenly over time Account for context switch time
Quick, non-optimal solution to NP-hard problem
![Page 20: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/20.jpg)
Constraint Feasibility Constraint Feasibility AnalysisAnalysis
Feasibility Analysis First considers activity reservation nodes Then considers free graph nodes
Infeasible constraints denied Feasible constraints accepted and
guaranteed Time intervals in graph are assigned to
their execution
![Page 21: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/21.jpg)
EDF Constraint ExecutionEDF Constraint Execution
Constraints executed in EDF order During the intervals assigned to
constraints Improves cache locality
Eliminates timeslicing among constraints
![Page 22: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/22.jpg)
Additional GoalsAdditional Goals
Fair sharing of free CPU among activities Fair sharing of CPU among threads within
same activity Unless threads use constraints or
synchronization objects
Best effort to: finish underestimated constraints expedite denied constraints
![Page 23: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/23.jpg)
Next Thread SelectionNext Thread Selection
1. If time remaining within node below threshold, select next node
2. If during assigned time interval, execute constraint EDF
3. If reserved node, select best thread within activity (default round-robin)
4. Select best activity (default round-robin), and thread within it
![Page 24: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/24.jpg)
OutlineOutline
Research Goals
Programming Model
Scheduling Architecture
How much does it cost?What can it do?
Conclusions
![Page 25: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/25.jpg)
On 200MHz Pentium Pro PC: 21.2µs Context switch time 32µs (10µs + 22µs trap) Atomic
EndConstraint()/BeginConstraint() CPU reservation operations:
150µs (19µs + 131µs RPC) Incr. Add() 98µs (11µs + 87µs RPC) Release()
Micro-benchmark TimesMicro-benchmark Times
![Page 26: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/26.jpg)
Cost of Scheduling Plan ChangesCost of Scheduling Plan Changes
Time fully reserved - 58 activities, each reserving 400µs per:
1s, 1s, 500ms, 1s, 500ms, 250ms, 1s, 500ms, 250ms, 125ms, …
0
1
2
3
41 6 11 16 21 26 31 36 41 46 51 56
Reservation Number
Tim
e to
Mak
e R
eser
vatio
n (m
s)Reasonable even in pathological cases
![Page 27: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/27.jpg)
Costs of Feasibility AnalysisCosts of Feasibility Analysis
Same 58 simultaneous activities, 4 threads each
Threads request 300µs within 3s in future
020406080
100120140
0 40 80 120 160 200 240
Time Constraint Request
Fea
sibi
lity
Ana
lysi
s (µ
s)
No Reservations With Reservations
Reasonable even in pathological cases
![Page 28: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/28.jpg)
OutlineOutline
Research Goals
Programming Model
Scheduling Architecture
How much does it cost?
What can it do?Conclusions
![Page 29: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/29.jpg)
Achieving Bounded Response:Achieving Bounded Response: Time Constraints against Time SharingTime Constraints against Time Sharing
0100200300400500600700800
0 1 2 3 4 5 6 7 8
# of Competing Activities
Tim
e t
o F
inis
h W
ork
(m
s)
Work w ith no reservations or constraints
Work w ith 50ms/200ms constraints
Time to complete 50ms of work, no reservations
Desired responsiveness achieved under load
![Page 30: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/30.jpg)
Achieving Bounded Response: Achieving Bounded Response: Constraints & Reservations against ReservationsConstraints & Reservations against Reservations
0200400600800
100012001400
0 1 2 3 4 5 6 7 8
# of Competing Activities
Tim
e to
Fin
ish
Wor
k (m
s)
Work w ith 50ms/200ms constraints but no reservation
Work w ith 50ms/200ms constraints & 10% reservation
Time to complete 50ms work with constraints,competing activities with 10% reservations
Bounded response achieved with reservation
![Page 31: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/31.jpg)
Adding Reservations to Existing AppsAdding Reservations to Existing Apps
0%
20%
40%
60%
80%
100%
Application
% F
ram
es R
ende
red
Round-robinscheduler
RialtoScheduler
1 MPEG & 5 AVI players, w/ reservations on Rialto
CPU reservations improve performance
![Page 32: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/32.jpg)
ConclusionsConclusions Precomputed scheduling plans enable
efficient implementation of: Continuously guaranteed CPU reservations Time constraints with accurate a priori
feasibility analysis
Abstractions support incremental development, co-existence of independent real-time applications
General-purpose OSs can provide practical, efficient, real-time services
![Page 33: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/33.jpg)
AcknowledgmentsAcknowledgments
OS Research Group at Microsoft Research
Microsoft Interactive TV Team Kevin Jeffay, Karsten Schwan,
Patricia Jones, Susan Owicki, George Candea, Jason Nieh
![Page 34: CPU Reservations and Time Constraints: Efficient, Predictable Scheduling of Independent Activities Michael B. Jones, Microsoft Research Daniela Roşu, Georgia](https://reader036.vdocuments.us/reader036/viewer/2022062511/551475a8550346494e8b62b6/html5/thumbnails/34.jpg)
For More InformationFor More Information
SOSP ’97 CD includes simulator used to develop algorithms
Also see http://research.microsoft.com/~mbj/
http://www.cc.gatech.edu/~daniela/
http://www.cc.gatech.edu/~rosu/