supporting time-sensitive applications on a commodity os by ashvin goel, luca abeni, charles krasic,...
Post on 20-Dec-2015
217 views
TRANSCRIPT
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
Why?Why?
Time sensitive applicationsTime sensitive applications– Enhancing resource allocationEnhancing resource allocation
ThroughputThroughput– Insignificant degradation Insignificant degradation
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
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
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
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
Example of overshootExample of overshoot
Last eventhandled
Next event Overshoot
0 5 10 Time
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
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
SchedulingScheduling
Proportion-Period schedulingProportion-Period scheduling Priority CPU schedulingPriority CPU scheduling
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
Proportion SchedulingProportion Scheduling
CPU CPU CPU CPU
Periods
Time
Priority schedulingPriority scheduling
Priority assigned based on Priority assigned based on application needsapplication needs
Run in the backgroundRun in the background Priority inversionPriority inversion
Priority inversionPriority inversion
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
20 processes, 10 msec20 processes, 10 msec
50 processes , 10 msec50 processes , 10 msec
20 processes, 1 msec20 processes, 1 msec
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
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