Vassal: Loadable Scheduler Support for Multi-Policy Scheduling
-
Upload
stacey-burgess -
Category
Documents
-
view
15 -
download
1
description
Transcript of Vassal: Loadable Scheduler Support for Multi-Policy Scheduling
![Page 1: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/1.jpg)
Vassal: Loadable Scheduler Support for Multi-Policy Scheduling
George M. Candea, Oracle Corporation
Michael B. Jones, Microsoft Research
![Page 2: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/2.jpg)
The Problem
OS multiplexes CPU among tasks OS not always aware of scheduling requirements
No algorithm is good enough for all task mixes Compromise: Hardcode set of scheduling policies into
the operating system Desirable: Dynamically extensible set of policies
![Page 3: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/3.jpg)
Overview of Vassal
Tasks can use custom scheduling policies Custom schedulers
– are special Windows NT drivers– coexist with the Windows NT scheduler– have negligible impact on global performance
In current prototype, one external scheduler loaded at once
![Page 4: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/4.jpg)
Outline
Motivation and OverviewWindows NT SchedulingVassal Design and ImplementationSample SchedulerResultsConclusions
![Page 5: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/5.jpg)
Windows NT Scheduling
Schedulable unit = thread Priority-based thread scheduling Two policies, in distinct priority ranges:
– Variable (dynamic priority round-robin)– Real-Time (fixed priority round-robin)
![Page 6: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/6.jpg)
NT Scheduling Precedence
1. Interrupts
2. Deferred Procedure Calls (DPCs)
3. Threads
Not all time gets scheduled based on priorities Scheduling predictability is limited
![Page 7: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/7.jpg)
NT Scheduling Events
Scheduling decisions triggered by:– End of thread quantum– Priority or affinity changes– Transition to Wait state– Wakeups
![Page 8: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/8.jpg)
Windows NT Timers
Hardware Abstraction Layer (HAL) provides kernel with a periodic timer
Resolution selectable from 1 to 15 ms (default: 10 or 15 ms)
Not all HALs implement all values– MP HAL provides 1, 2, 4, 8, 16 ms– Some HALs just implement 10 ms
![Page 9: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/9.jpg)
Outline
Motivation and OverviewWindows NT SchedulingVassal Design and ImplementationSample SchedulerResultsConclusions
![Page 10: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/10.jpg)
Separate Policy from Mechanism
NT scheduler = thread dispatcher with scheduling policies interspersed
Vassal = separate scheduling and dispatching modules– Schedulers: policy modules that decide which
threads to run– Dispatcher: runs threads selected by
schedulers
![Page 11: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/11.jpg)
Details of Present Prototype
Standard NT policies remain in kernel Schedulers are in a hierarchy
– Give loaded scheduler first choice– Ask native scheduler if loaded scheduler
makes no choice– Could easily support deeper hierarchy
By default, threads use NT policies
![Page 12: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/12.jpg)
Vassal Entities
Schedulers– Register decision making routines with
dispatcher Dispatcher
– Invokes decision routines when scheduling events occur
Threads– Communicate with schedulers to request
services
![Page 13: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/13.jpg)
Vassal Architecture
Hardware Abstraction Layer (HAL)
ExternalScheduler
ThreadDispatcher
NT Scheduler
Kernel
Application ThreadUser space
Drivers
![Page 14: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/14.jpg)
Interface Modifications
Extend driver interface for schedulers: – RegisterScheduler– SetSchedulerEvent
Extend syscall interface for threads– MessageToScheduler
![Page 15: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/15.jpg)
Registering a Scheduler
RegisterScheduler (scheduler identifier, decision making routine, message dispatcher routine)
Invoked by driver at initialization time Dispatcher checks for conflicts and updates
scheduler hierarchy Dispatcher queries scheduler by invoking the
decision making routine
![Page 16: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/16.jpg)
Communicating with a Scheduler
MessageToScheduler (scheduler identifier, message buffer, message length)
Thread sends message to specific scheduler Corresponding scheduler’s message dispatcher
extracts message from buffer and responds
![Page 17: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/17.jpg)
Precisely Timed Events
SetSchedulerEvent (scheduler identifier, absolute time value)
Scheduler requests control of CPU at certain absolute time
Dispatcher invokes scheduler’s decision routine at specified time
![Page 18: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/18.jpg)
Vassal Interfaces
Hardware Abstraction Layer (HAL)
ExternalScheduler
ThreadDispatcher
NT Scheduler
Kernel
Application ThreadUser space
Drivers
MessageToScheduler
RegisterScheduler
SetSchedulerEvent
![Page 19: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/19.jpg)
Outline
Motivation and OverviewWindows NT SchedulingVassal Design and ImplementationSample SchedulerResultsConclusions
![Page 20: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/20.jpg)
Sample Real-Time Scheduler
Allows threads to get scheduled at application-specified time instances
Demonstrates potential for more interesting time-based policies
![Page 21: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/21.jpg)
Using The Real-Time SchedulerTell system to use the real-time scheduler
status = MessageToScheduler (RT_scheduler, {JOIN})if status != SUCCESS
error (“Could not join R/T scheduling class.”)
We want one iteration every 1ms
while TRUE do {status = MessageToScheduler (RT_scheduler,
{SET, wakeup_time})…wakeup_time = wakeup_time + 1 msec
}
![Page 22: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/22.jpg)
Execution of Sample Code
T
Event occurred
Request thread
Scheduler
Kernel
ThreadRUN WAIT RUN
Update data
structures
Join R/Tscheduling
class
Update data
structures
Set time constraint
Set preciselytimed event
Make scheduling
decision
Dispatch thread
predicted
![Page 23: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/23.jpg)
Outline
Motivation and OverviewWindows NT SchedulingVassal Design and ImplementationSample SchedulerResultsConclusions
![Page 24: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/24.jpg)
Windows NT Kernel Changes
Added 188 lines of C code Added 61 assembly instructions Replaced 6 assembly instructions
![Page 25: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/25.jpg)
Context Switch TimesSystem Version Median Avg. Std. Dev.Vanilla NT 4.0 (released) 17.03 18.71 4.17Vanilla NT 4.0 (rebuilt) 19.95 19.88 1.64Vassal (no loaded scheduler) 19.71 19.71 1.56Vassal (sample scheduler loaded) 21.32 21.17 1.28
Context switch times on original and modified systems (µs, P-133)
No significant difference when external schedulers not loaded
8% overhead on untuned prototype when using loaded schedulers
![Page 26: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/26.jpg)
Writing a Scheduler
Proof-of-concept real-time scheduler:– 116 lines of C code– No assembly language
Only need to code the policy
![Page 27: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/27.jpg)
Periodic Wakeup Times
Method Min. Max. Avg. Std. Dev.NT Multimedia Timers 75 1566 996 82Sample Scheduler Events 996 1485 1002 21
Wakeup times using multimedia timers on vanilla system and sample scheduler on Vassal (µs, P-133). Desired value is 1000.
No early wakeups when using our scheduler Predictability significantly improved Believe late samples due to unscheduled activities
![Page 28: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/28.jpg)
Outline
Motivation and OverviewWindows NT SchedulingVassal Design and ImplementationSample SchedulerResultsConclusions
![Page 29: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/29.jpg)
Vassal Take-Home
Demonstrates viability and effectiveness of loadable schedulers
Frees OS from anticipating all possible application scheduling requirements
Encourages scheduling research by making it easy to develop and test new policies
Insignificant performance impact
![Page 30: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/30.jpg)
Limitations and Future Work
Timing precision limited by HAL Predictability limited by interrupts and
DPC activity Only one loaded scheduler supported External schedulers not fully MP aware
![Page 31: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/31.jpg)
Related Work
Solaris scheduler class drivers– Must map scheduling decisions onto global
thread priority space Extensible OS work
– Spin, Exokernel, Vino Hierarchical schedulers
– Utah CPU inheritance scheduling– UIUC Windows NT soft real-time scheduler
![Page 32: Vassal: Loadable Scheduler Support for Multi-Policy Scheduling](https://reader036.fdocuments.in/reader036/viewer/2022070401/56813657550346895d9de0dc/html5/thumbnails/32.jpg)
For More Information...
http://pdos.lcs.mit.edu/~candea/research.html http://research.microsoft.com/~mbj/