Download presentation
Presentation is loading. Please wait.
Published byAriana Dean Modified over 11 years ago
1
Vassal: Loadable Scheduler Support for Multi-Policy Scheduling George M. Candea, Oracle Corporation Michael B. Jones, Microsoft Research
2
The Problem u OS multiplexes CPU among tasks u OS not always aware of scheduling requirements u No algorithm is good enough for all task mixes u Compromise: Hardcode set of scheduling policies into the operating system u Desirable: Dynamically extensible set of policies
3
Overview of Vassal u Tasks can use custom scheduling policies u Custom schedulers –are special Windows NT drivers –coexist with the Windows NT scheduler –have negligible impact on global performance u In current prototype, one external scheduler loaded at once
4
Outline Motivation and Overview Windows NT Scheduling Vassal Design and Implementation Sample Scheduler Results Conclusions
5
Windows NT Scheduling u Schedulable unit = thread u Priority-based thread scheduling u Two policies, in distinct priority ranges: –Variable (dynamic priority round-robin) –Real-Time (fixed priority round-robin)
6
NT Scheduling Precedence 1. Interrupts 2. Deferred Procedure Calls (DPCs) 3. Threads u Not all time gets scheduled based on priorities u Scheduling predictability is limited
7
NT Scheduling Events u Scheduling decisions triggered by: –End of thread quantum –Priority or affinity changes –Transition to Wait state –Wakeups
8
Windows NT Timers u Hardware Abstraction Layer (HAL) provides kernel with a periodic timer u Resolution selectable from 1 to 15 ms (default: 10 or 15 ms) u Not all HALs implement all values –MP HAL provides 1, 2, 4, 8, 16 ms –Some HALs just implement 10 ms
9
Outline Motivation and Overview Windows NT Scheduling Vassal Design and Implementation Sample Scheduler Results Conclusions
10
Separate Policy from Mechanism u NT scheduler = thread dispatcher with scheduling policies interspersed u Vassal = separate scheduling and dispatching modules –Schedulers: policy modules that decide which threads to run –Dispatcher: runs threads selected by schedulers
11
Details of Present Prototype u Standard NT policies remain in kernel u Schedulers are in a hierarchy –Give loaded scheduler first choice –Ask native scheduler if loaded scheduler makes no choice –Could easily support deeper hierarchy u By default, threads use NT policies
12
Vassal Entities u Schedulers –Register decision making routines with dispatcher u Dispatcher –Invokes decision routines when scheduling events occur u Threads –Communicate with schedulers to request services
13
Vassal Architecture Hardware Abstraction Layer (HAL) External Scheduler Thread Dispatcher NT Scheduler Kernel Application Thread User space Drivers
14
Interface Modifications u Extend driver interface for schedulers: –RegisterScheduler –SetSchedulerEvent u Extend syscall interface for threads –MessageToScheduler
15
Registering a Scheduler RegisterScheduler (scheduler identifier, decision making routine, message dispatcher routine) u Invoked by driver at initialization time u Dispatcher checks for conflicts and updates scheduler hierarchy u Dispatcher queries scheduler by invoking the decision making routine
16
Communicating with a Scheduler MessageToScheduler (scheduler identifier, message buffer, message length) u Thread sends message to specific scheduler u Corresponding schedulers message dispatcher extracts message from buffer and responds
17
Precisely Timed Events SetSchedulerEvent (scheduler identifier, absolute time value) u Scheduler requests control of CPU at certain absolute time u Dispatcher invokes schedulers decision routine at specified time
18
Vassal Interfaces Hardware Abstraction Layer (HAL) External Scheduler Thread Dispatcher NT Scheduler Kernel Application Thread User space Drivers MessageToScheduler RegisterScheduler SetSchedulerEvent
19
Outline Motivation and Overview Windows NT Scheduling Vassal Design and Implementation Sample Scheduler Results Conclusions
20
Sample Real-Time Scheduler u Allows threads to get scheduled at application-specified time instances u Demonstrates potential for more interesting time-based policies
21
Using The Real-Time Scheduler Tell 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 }
22
Execution of Sample Code T Event occurred Request thread Scheduler Kernel Thread RUNWAITRUN Update data structures Join R/T scheduling class Update data structures Set time constraint Set precisely timed event Make scheduling decision Dispatch thread predicted
23
Outline Motivation and Overview Windows NT Scheduling Vassal Design and Implementation Sample Scheduler Results Conclusions
24
Windows NT Kernel Changes u Added 188 lines of C code u Added 61 assembly instructions u Replaced 6 assembly instructions
25
Context Switch Times Context switch times on original and modified systems (µs, P-133) u No significant difference when external schedulers not loaded u 8% overhead on untuned prototype when using loaded schedulers
26
Writing a Scheduler u Proof-of-concept real-time scheduler: –116 lines of C code –No assembly language u Only need to code the policy
27
Periodic Wakeup Times Wakeup times using multimedia timers on vanilla system and sample scheduler on Vassal (µs, P-133). Desired value is 1000. u No early wakeups when using our scheduler u Predictability significantly improved u Believe late samples due to unscheduled activities
28
Outline Motivation and Overview Windows NT Scheduling Vassal Design and Implementation Sample Scheduler Results Conclusions
29
Vassal Take-Home u Demonstrates viability and effectiveness of loadable schedulers u Frees OS from anticipating all possible application scheduling requirements u Encourages scheduling research by making it easy to develop and test new policies u Insignificant performance impact
30
Limitations and Future Work u Timing precision limited by HAL u Predictability limited by interrupts and DPC activity u Only one loaded scheduler supported u External schedulers not fully MP aware
31
Related Work u Solaris scheduler class drivers –Must map scheduling decisions onto global thread priority space u Extensible OS work –Spin, Exokernel, Vino u Hierarchical schedulers –Utah CPU inheritance scheduling –UIUC Windows NT soft real-time scheduler
32
For More Information... u http://pdos.lcs.mit.edu/~candea/research.html u http://research.microsoft.com/~mbj/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.