Vassal loadable scheduler support for multi policy scheduling
Download
1 / 32

Vassal: Loadable Scheduler Support for Multi-Policy Scheduling - PowerPoint PPT Presentation


  • 129 Views
  • Uploaded on

Vassal: Loadable Scheduler Support for Multi-Policy Scheduling. George M. Candea, Oracle Corporation Michael B. Jones, Microsoft Research. The Problem. OS multiplexes CPU among tasks OS not always aware of scheduling requirements No algorithm is good enough for all task mixes

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Vassal: Loadable Scheduler Support for Multi-Policy Scheduling' - afram


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Vassal loadable scheduler support for multi policy scheduling l.jpg

Vassal: Loadable Scheduler Support for Multi-Policy Scheduling

George M. Candea, Oracle Corporation

Michael B. Jones, Microsoft Research


The problem l.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


Overview of vassal l.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


Outline l.jpg
Outline

Motivation and Overview

Windows NT Scheduling

Vassal Design and Implementation

Sample Scheduler

Results

Conclusions


Windows nt scheduling l.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)


Nt scheduling precedence l.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


Nt scheduling events l.jpg
NT Scheduling Events

  • Scheduling decisions triggered by:

    • End of thread quantum

    • Priority or affinity changes

    • Transition to Wait state

    • Wakeups


Windows nt timers l.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


Outline9 l.jpg
Outline

Motivation and Overview

Windows NT Scheduling

Vassal Design and Implementation

Sample Scheduler

Results

Conclusions


Separate policy from mechanism l.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


Details of present prototype l.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


Vassal entities l.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


Vassal architecture l.jpg

Application Thread

User space

NT Scheduler

External

Scheduler

Thread

Dispatcher

Kernel

Vassal Architecture

Hardware Abstraction Layer (HAL)

Drivers


Interface modifications l.jpg
Interface Modifications

  • Extend driver interface for schedulers:

    • RegisterScheduler

    • SetSchedulerEvent

  • Extend syscall interface for threads

    • MessageToScheduler


Registering a scheduler l.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


Communicating with a scheduler l.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


Precisely timed events l.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


Vassal interfaces l.jpg

NT Scheduler

Vassal Interfaces

Application Thread

User space

MessageToScheduler

External

Scheduler

Thread

Dispatcher

RegisterScheduler

Kernel

SetSchedulerEvent

Hardware Abstraction Layer (HAL)

Drivers


Outline19 l.jpg
Outline

Motivation and Overview

Windows NT Scheduling

Vassal Design and Implementation

Sample Scheduler

Results

Conclusions


Sample real time scheduler l.jpg
Sample Real-Time Scheduler

  • Allows threads to get scheduled at application-specified time instances

  • Demonstrates potential for more interesting time-based policies


Using the real time scheduler l.jpg
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

}


Execution of sample code l.jpg

RUN

WAIT

RUN

Thread

Join R/T

scheduling class

Set time constraint

Event occurred

Kernel

Dispatch thread

Request thread

Make scheduling decision

Scheduler

Update datastructures

Update data structures

Set precisely

timed event

predicted

Execution of Sample Code

T


Outline23 l.jpg
Outline

Motivation and Overview

Windows NT Scheduling

Vassal Design and Implementation

Sample Scheduler

Results

Conclusions


Windows nt kernel changes l.jpg
Windows NT Kernel Changes

  • Added 188 lines of C code

  • Added 61 assembly instructions

  • Replaced 6 assembly instructions


Context switch times l.jpg
Context Switch Times

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


Writing a scheduler l.jpg
Writing a Scheduler

  • Proof-of-concept real-time scheduler:

    • 116 lines of C code

    • No assembly language

  • Only need to code the policy


Periodic wakeup times l.jpg
Periodic Wakeup Times

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


Outline28 l.jpg
Outline

Motivation and Overview

Windows NT Scheduling

Vassal Design and Implementation

Sample Scheduler

Results

Conclusions


Vassal take home l.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


Limitations and future work l.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


Related work l.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


For more information l.jpg
For More Information...

  • http://pdos.lcs.mit.edu/~candea/research.html

  • http://research.microsoft.com/~mbj/