21
Sensitive Sensitive Applications on a Applications on a Commodity OS Commodity OS by by Ashvin Goel, Luca Abeni, Ashvin Goel, Luca Abeni, Charles Krasic, Jim Charles Krasic, Jim Snow, Jonathan Walpole Snow, Jonathan Walpole Jimi Watson Jimi Watson

Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Supporting Time-Supporting Time-Sensitive Applications Sensitive Applications on a Commodity OSon a Commodity OS

bybyAshvin Goel, Luca Abeni, Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Charles Krasic, Jim Snow,

Jonathan WalpoleJonathan WalpoleJimi WatsonJimi Watson

Page 2: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Why?Why?

Time sensitive applicationsTime sensitive applications– Enhancing resource allocationEnhancing resource allocation

ThroughputThroughput– Insignificant degradation Insignificant degradation

Page 3: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Four keysFour keys

Timing mechanismsTiming mechanisms– Timer latencyTimer latency

Responsive KernelResponsive Kernel– Preemption latencyPreemption latency

CPU scheduling algorithmCPU scheduling algorithm– Scheduling latencyScheduling latency

Use them allUse them all

Page 4: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson
Page 5: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

TimersTimers

Periodic timersPeriodic timers– The old modelThe old model– Shortest period 10msecShortest period 10msec

One-shot timersOne-shot timers– Interrupts at specific instanceInterrupts at specific instance– ReprogramReprogram

Soft timersSoft timers– Handles events at soft timer pointsHandles events at soft timer points

Page 6: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Timers ComparisonTimers Comparison

Hard timersHard timers– Interrupt handlingInterrupt handling– Cache pollutionCache pollution

Soft timersSoft timers– Polling for expired eventsPolling for expired events

Firm timersFirm timers– Better precisionBetter precision– Fewer interuptsFewer interupts

Page 7: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Firm TimersFirm Timers

Combination of soft and one shot Combination of soft and one shot timerstimers

Use soft timers to reduce overheadUse soft timers to reduce overhead Use one-shot timers to ensure events Use one-shot timers to ensure events

are handledare handled OvershootOvershoot

Page 8: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Example of overshootExample of overshoot

Last eventhandled

Next event Overshoot

0 5 10 Time

Page 9: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Firm timer implementationFirm timer implementation

Timer queueTimer queue APIC is set to next timer event plus global APIC is set to next timer event plus global

overshoot valueovershoot value– Possible to have overshoot for separate timersPossible to have overshoot for separate timers

Apps with tighter constraints incur penaltyApps with tighter constraints incur penalty Overhead is simply additional queue and overshootOverhead is simply additional queue and overshoot

Periodic timers used for long timeoutsPeriodic timers used for long timeouts– One shot timers only within 1 tick periodOne shot timers only within 1 tick period

POSIX interface calls altered to take POSIX interface calls altered to take advantage of firm timers on TSLadvantage of firm timers on TSL

Page 10: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Kernel preemptibilityKernel preemptibility

May not be preemtibleMay not be preemtible– Interrupts disabledInterrupts disabled– Executing in critical sectionExecuting in critical section

SolutionSolution– Shorten the length it is not preemptibleShorten the length it is not preemptible– Explicit preemption pointsExplicit preemption points– Lock breaking preemtible kernelLock breaking preemtible kernel

Page 11: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

SchedulingScheduling

Proportion-Period schedulingProportion-Period scheduling Priority CPU schedulingPriority CPU scheduling

Page 12: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Proportion-Period Proportion-Period schedulingscheduling

Temporal protectionTemporal protection Every time sensitive task requires Every time sensitive task requires

specification of proportion and periodspecification of proportion and period Proportion is how much CPU it needsProportion is how much CPU it needs Period is how often the task needs Period is how often the task needs

CPU to guarantee proper functionCPU to guarantee proper function

Page 13: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Proportion SchedulingProportion Scheduling

CPU CPU CPU CPU

Periods

Time

Page 14: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Priority schedulingPriority scheduling

Priority assigned based on Priority assigned based on application needsapplication needs

Run in the backgroundRun in the background Priority inversionPriority inversion

Page 15: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

Priority inversionPriority inversion

Page 16: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

TestingTesting

Compare Linux, soft timers, hard Compare Linux, soft timers, hard timers and firm timerstimers and firm timers

Multiple applications Multiple applications Each require 10 msec intervalsEach require 10 msec intervals

Page 17: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

20 processes, 10 msec20 processes, 10 msec

Page 18: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

50 processes , 10 msec50 processes , 10 msec

Page 19: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

20 processes, 1 msec20 processes, 1 msec

Page 20: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

TestingTesting

Difference between hard and firm Difference between hard and firm timerstimers– Firm timers have lower overhead when a Firm timers have lower overhead when a

percentage of soft timers fire per pollpercentage of soft timers fire per poll

– NNss/N/Ncc > 2.1 % > 2.1 %

Variation > 400 usec under heavy Variation > 400 usec under heavy loadsloads

Low overhead on throughput loadsLow overhead on throughput loads

Page 21: Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson

ConclusionsConclusions

Better performance for all Better performance for all applicationsapplications

Gracefully handles soft real time Gracefully handles soft real time appsapps

Very little impact on throughputVery little impact on throughput Useful general purpose OSUseful general purpose OS