Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

28
CS533 CS533 1 Supporting Time- Supporting Time- Sensitive Applications Sensitive Applications on a GENERAL PURPOSE on a GENERAL PURPOSE ( ( Commodity Commodity ) OS ) OS Ashvin Goel, Luca Abeni, Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Charles Krasic, Jim Snow, Jonathan Walpole Jonathan Walpole Dept of Computer Science , OGI Dept of Computer Science , OGI Presenter – PRADEEP ANKAL Presenter – PRADEEP ANKAL A A

description

Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS. Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Dept of Computer Science , OGI Presenter – PRADEEP ANKALA. Real-Time & General Purpose OS’s. - PowerPoint PPT Presentation

Transcript of Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

Page 1: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 11

Supporting Time-Supporting Time-Sensitive Applications Sensitive Applications on a GENERAL on a GENERAL PURPOSE (PURPOSE (CommodityCommodity) ) OSOS

Ashvin Goel Luca Abeni Charles Ashvin Goel Luca Abeni Charles Krasic Jim Snow Jonathan WalKrasic Jim Snow Jonathan WalpolepoleDept of Computer Science OGIDept of Computer Science OGI

Presenter ndash PRADEEP ANKALAPresenter ndash PRADEEP ANKALA

CS533CS533 22

Real-Time amp General Purpose OSrsquos

- Real-Time OS VxWorks QNX LynxOS eCosDeltaOS PSXembOS

- GPOS no support for real-time

- applications focus on lsquofairnessrsquo

- BUT people love GPOSs eg Linux

CS533CS533 33

OutlineOutline

IntroductionIntroduction Implementing Time-Sensitive LinuxImplementing Time-Sensitive Linux ExperimentExperiment ConclusionsConclusions

CS533CS533 44

IntroductionIntroduction

Time-sensitive Applications Time-sensitive Applications ( Ex( Exmultimedia soft real-time applications )multimedia soft real-time applications )

High precision timing facilityHigh precision timing facility Well designed preemptible kernelWell designed preemptible kernel Appropriate scheduling techniqueAppropriate scheduling technique

Time-Sensitive RequirementTime-Sensitive Requirement Timing MechanismTiming Mechanism Responsive KernelResponsive Kernel CPU Scheduling AlgorithmCPU Scheduling Algorithm

CS533CS533 55

Paperrsquos Contribution

1048698 Situation Linux (and many other OSrsquos)

cannot handle real-time applications 1048698 Hypothesis a few techniques can overcome

the limitations of Linux

ndash Firm timer (high resolution)

ndash Fine-grain kernel preemption

ndash Priority and reservation-based scheduling 1048698 Good performance and low overhead

CS533CS533 66

Problems and Solutions

1048698 Firm Timer reduces timer latencyndash Low overhead important

1048698 Fine-grain kernel preemption reduces preemption latency

ndash Responsive kernel 1048698 Good schedulers reduce scheduling

latencyndash Proportion-period scheduler

CS533CS533 77

Kernel LatencyKernel Latency

CS533CS533 88

TSL IntroductionTSL Introduction

Integrated techniques of TSLIntegrated techniques of TSL Firm timersFirm timers

One-shot timersOne-shot timers Soft timers Soft timers Timer OvershootTimer Overshoot

Fine-grained kernel preemptibilityFine-grained kernel preemptibility CPU Scheduling CPU Scheduling

Priority-basedPriority-based Proportion-periodProportion-period

CS533CS533 99

Firm TimersFirm Timers

One-shot timersOne-shot timers- - Reprogrammed for next timer interrupt

+ Soft timers (+ Soft timers (reduce interrupt overhead)

ndash Polling at convenient times (eg syscall return)

(No interrupt check timer at some check pointers(No interrupt check timer at some check pointersReduce of timer interruptsReduce of timer interruptsReduce of context switches)Reduce of context switches)

+Timer Overshoot+Timer Overshootndash Reduce variance due to soft timer uncertainty

Combination of One-shot timers and Soft timers witCombination of One-shot timers and Soft timers with system wide h system wide timer overshoottimer overshoot parameter parameter

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 2: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 22

Real-Time amp General Purpose OSrsquos

- Real-Time OS VxWorks QNX LynxOS eCosDeltaOS PSXembOS

- GPOS no support for real-time

- applications focus on lsquofairnessrsquo

- BUT people love GPOSs eg Linux

CS533CS533 33

OutlineOutline

IntroductionIntroduction Implementing Time-Sensitive LinuxImplementing Time-Sensitive Linux ExperimentExperiment ConclusionsConclusions

CS533CS533 44

IntroductionIntroduction

Time-sensitive Applications Time-sensitive Applications ( Ex( Exmultimedia soft real-time applications )multimedia soft real-time applications )

High precision timing facilityHigh precision timing facility Well designed preemptible kernelWell designed preemptible kernel Appropriate scheduling techniqueAppropriate scheduling technique

Time-Sensitive RequirementTime-Sensitive Requirement Timing MechanismTiming Mechanism Responsive KernelResponsive Kernel CPU Scheduling AlgorithmCPU Scheduling Algorithm

CS533CS533 55

Paperrsquos Contribution

1048698 Situation Linux (and many other OSrsquos)

cannot handle real-time applications 1048698 Hypothesis a few techniques can overcome

the limitations of Linux

ndash Firm timer (high resolution)

ndash Fine-grain kernel preemption

ndash Priority and reservation-based scheduling 1048698 Good performance and low overhead

CS533CS533 66

Problems and Solutions

1048698 Firm Timer reduces timer latencyndash Low overhead important

1048698 Fine-grain kernel preemption reduces preemption latency

ndash Responsive kernel 1048698 Good schedulers reduce scheduling

latencyndash Proportion-period scheduler

CS533CS533 77

Kernel LatencyKernel Latency

CS533CS533 88

TSL IntroductionTSL Introduction

Integrated techniques of TSLIntegrated techniques of TSL Firm timersFirm timers

One-shot timersOne-shot timers Soft timers Soft timers Timer OvershootTimer Overshoot

Fine-grained kernel preemptibilityFine-grained kernel preemptibility CPU Scheduling CPU Scheduling

Priority-basedPriority-based Proportion-periodProportion-period

CS533CS533 99

Firm TimersFirm Timers

One-shot timersOne-shot timers- - Reprogrammed for next timer interrupt

+ Soft timers (+ Soft timers (reduce interrupt overhead)

ndash Polling at convenient times (eg syscall return)

(No interrupt check timer at some check pointers(No interrupt check timer at some check pointersReduce of timer interruptsReduce of timer interruptsReduce of context switches)Reduce of context switches)

+Timer Overshoot+Timer Overshootndash Reduce variance due to soft timer uncertainty

Combination of One-shot timers and Soft timers witCombination of One-shot timers and Soft timers with system wide h system wide timer overshoottimer overshoot parameter parameter

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 3: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 33

OutlineOutline

IntroductionIntroduction Implementing Time-Sensitive LinuxImplementing Time-Sensitive Linux ExperimentExperiment ConclusionsConclusions

CS533CS533 44

IntroductionIntroduction

Time-sensitive Applications Time-sensitive Applications ( Ex( Exmultimedia soft real-time applications )multimedia soft real-time applications )

High precision timing facilityHigh precision timing facility Well designed preemptible kernelWell designed preemptible kernel Appropriate scheduling techniqueAppropriate scheduling technique

Time-Sensitive RequirementTime-Sensitive Requirement Timing MechanismTiming Mechanism Responsive KernelResponsive Kernel CPU Scheduling AlgorithmCPU Scheduling Algorithm

CS533CS533 55

Paperrsquos Contribution

1048698 Situation Linux (and many other OSrsquos)

cannot handle real-time applications 1048698 Hypothesis a few techniques can overcome

the limitations of Linux

ndash Firm timer (high resolution)

ndash Fine-grain kernel preemption

ndash Priority and reservation-based scheduling 1048698 Good performance and low overhead

CS533CS533 66

Problems and Solutions

1048698 Firm Timer reduces timer latencyndash Low overhead important

1048698 Fine-grain kernel preemption reduces preemption latency

ndash Responsive kernel 1048698 Good schedulers reduce scheduling

latencyndash Proportion-period scheduler

CS533CS533 77

Kernel LatencyKernel Latency

CS533CS533 88

TSL IntroductionTSL Introduction

Integrated techniques of TSLIntegrated techniques of TSL Firm timersFirm timers

One-shot timersOne-shot timers Soft timers Soft timers Timer OvershootTimer Overshoot

Fine-grained kernel preemptibilityFine-grained kernel preemptibility CPU Scheduling CPU Scheduling

Priority-basedPriority-based Proportion-periodProportion-period

CS533CS533 99

Firm TimersFirm Timers

One-shot timersOne-shot timers- - Reprogrammed for next timer interrupt

+ Soft timers (+ Soft timers (reduce interrupt overhead)

ndash Polling at convenient times (eg syscall return)

(No interrupt check timer at some check pointers(No interrupt check timer at some check pointersReduce of timer interruptsReduce of timer interruptsReduce of context switches)Reduce of context switches)

+Timer Overshoot+Timer Overshootndash Reduce variance due to soft timer uncertainty

Combination of One-shot timers and Soft timers witCombination of One-shot timers and Soft timers with system wide h system wide timer overshoottimer overshoot parameter parameter

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 4: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 44

IntroductionIntroduction

Time-sensitive Applications Time-sensitive Applications ( Ex( Exmultimedia soft real-time applications )multimedia soft real-time applications )

High precision timing facilityHigh precision timing facility Well designed preemptible kernelWell designed preemptible kernel Appropriate scheduling techniqueAppropriate scheduling technique

Time-Sensitive RequirementTime-Sensitive Requirement Timing MechanismTiming Mechanism Responsive KernelResponsive Kernel CPU Scheduling AlgorithmCPU Scheduling Algorithm

CS533CS533 55

Paperrsquos Contribution

1048698 Situation Linux (and many other OSrsquos)

cannot handle real-time applications 1048698 Hypothesis a few techniques can overcome

the limitations of Linux

ndash Firm timer (high resolution)

ndash Fine-grain kernel preemption

ndash Priority and reservation-based scheduling 1048698 Good performance and low overhead

CS533CS533 66

Problems and Solutions

1048698 Firm Timer reduces timer latencyndash Low overhead important

1048698 Fine-grain kernel preemption reduces preemption latency

ndash Responsive kernel 1048698 Good schedulers reduce scheduling

latencyndash Proportion-period scheduler

CS533CS533 77

Kernel LatencyKernel Latency

CS533CS533 88

TSL IntroductionTSL Introduction

Integrated techniques of TSLIntegrated techniques of TSL Firm timersFirm timers

One-shot timersOne-shot timers Soft timers Soft timers Timer OvershootTimer Overshoot

Fine-grained kernel preemptibilityFine-grained kernel preemptibility CPU Scheduling CPU Scheduling

Priority-basedPriority-based Proportion-periodProportion-period

CS533CS533 99

Firm TimersFirm Timers

One-shot timersOne-shot timers- - Reprogrammed for next timer interrupt

+ Soft timers (+ Soft timers (reduce interrupt overhead)

ndash Polling at convenient times (eg syscall return)

(No interrupt check timer at some check pointers(No interrupt check timer at some check pointersReduce of timer interruptsReduce of timer interruptsReduce of context switches)Reduce of context switches)

+Timer Overshoot+Timer Overshootndash Reduce variance due to soft timer uncertainty

Combination of One-shot timers and Soft timers witCombination of One-shot timers and Soft timers with system wide h system wide timer overshoottimer overshoot parameter parameter

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 5: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 55

Paperrsquos Contribution

1048698 Situation Linux (and many other OSrsquos)

cannot handle real-time applications 1048698 Hypothesis a few techniques can overcome

the limitations of Linux

ndash Firm timer (high resolution)

ndash Fine-grain kernel preemption

ndash Priority and reservation-based scheduling 1048698 Good performance and low overhead

CS533CS533 66

Problems and Solutions

1048698 Firm Timer reduces timer latencyndash Low overhead important

1048698 Fine-grain kernel preemption reduces preemption latency

ndash Responsive kernel 1048698 Good schedulers reduce scheduling

latencyndash Proportion-period scheduler

CS533CS533 77

Kernel LatencyKernel Latency

CS533CS533 88

TSL IntroductionTSL Introduction

Integrated techniques of TSLIntegrated techniques of TSL Firm timersFirm timers

One-shot timersOne-shot timers Soft timers Soft timers Timer OvershootTimer Overshoot

Fine-grained kernel preemptibilityFine-grained kernel preemptibility CPU Scheduling CPU Scheduling

Priority-basedPriority-based Proportion-periodProportion-period

CS533CS533 99

Firm TimersFirm Timers

One-shot timersOne-shot timers- - Reprogrammed for next timer interrupt

+ Soft timers (+ Soft timers (reduce interrupt overhead)

ndash Polling at convenient times (eg syscall return)

(No interrupt check timer at some check pointers(No interrupt check timer at some check pointersReduce of timer interruptsReduce of timer interruptsReduce of context switches)Reduce of context switches)

+Timer Overshoot+Timer Overshootndash Reduce variance due to soft timer uncertainty

Combination of One-shot timers and Soft timers witCombination of One-shot timers and Soft timers with system wide h system wide timer overshoottimer overshoot parameter parameter

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 6: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 66

Problems and Solutions

1048698 Firm Timer reduces timer latencyndash Low overhead important

1048698 Fine-grain kernel preemption reduces preemption latency

ndash Responsive kernel 1048698 Good schedulers reduce scheduling

latencyndash Proportion-period scheduler

CS533CS533 77

Kernel LatencyKernel Latency

CS533CS533 88

TSL IntroductionTSL Introduction

Integrated techniques of TSLIntegrated techniques of TSL Firm timersFirm timers

One-shot timersOne-shot timers Soft timers Soft timers Timer OvershootTimer Overshoot

Fine-grained kernel preemptibilityFine-grained kernel preemptibility CPU Scheduling CPU Scheduling

Priority-basedPriority-based Proportion-periodProportion-period

CS533CS533 99

Firm TimersFirm Timers

One-shot timersOne-shot timers- - Reprogrammed for next timer interrupt

+ Soft timers (+ Soft timers (reduce interrupt overhead)

ndash Polling at convenient times (eg syscall return)

(No interrupt check timer at some check pointers(No interrupt check timer at some check pointersReduce of timer interruptsReduce of timer interruptsReduce of context switches)Reduce of context switches)

+Timer Overshoot+Timer Overshootndash Reduce variance due to soft timer uncertainty

Combination of One-shot timers and Soft timers witCombination of One-shot timers and Soft timers with system wide h system wide timer overshoottimer overshoot parameter parameter

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 7: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 77

Kernel LatencyKernel Latency

CS533CS533 88

TSL IntroductionTSL Introduction

Integrated techniques of TSLIntegrated techniques of TSL Firm timersFirm timers

One-shot timersOne-shot timers Soft timers Soft timers Timer OvershootTimer Overshoot

Fine-grained kernel preemptibilityFine-grained kernel preemptibility CPU Scheduling CPU Scheduling

Priority-basedPriority-based Proportion-periodProportion-period

CS533CS533 99

Firm TimersFirm Timers

One-shot timersOne-shot timers- - Reprogrammed for next timer interrupt

+ Soft timers (+ Soft timers (reduce interrupt overhead)

ndash Polling at convenient times (eg syscall return)

(No interrupt check timer at some check pointers(No interrupt check timer at some check pointersReduce of timer interruptsReduce of timer interruptsReduce of context switches)Reduce of context switches)

+Timer Overshoot+Timer Overshootndash Reduce variance due to soft timer uncertainty

Combination of One-shot timers and Soft timers witCombination of One-shot timers and Soft timers with system wide h system wide timer overshoottimer overshoot parameter parameter

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 8: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 88

TSL IntroductionTSL Introduction

Integrated techniques of TSLIntegrated techniques of TSL Firm timersFirm timers

One-shot timersOne-shot timers Soft timers Soft timers Timer OvershootTimer Overshoot

Fine-grained kernel preemptibilityFine-grained kernel preemptibility CPU Scheduling CPU Scheduling

Priority-basedPriority-based Proportion-periodProportion-period

CS533CS533 99

Firm TimersFirm Timers

One-shot timersOne-shot timers- - Reprogrammed for next timer interrupt

+ Soft timers (+ Soft timers (reduce interrupt overhead)

ndash Polling at convenient times (eg syscall return)

(No interrupt check timer at some check pointers(No interrupt check timer at some check pointersReduce of timer interruptsReduce of timer interruptsReduce of context switches)Reduce of context switches)

+Timer Overshoot+Timer Overshootndash Reduce variance due to soft timer uncertainty

Combination of One-shot timers and Soft timers witCombination of One-shot timers and Soft timers with system wide h system wide timer overshoottimer overshoot parameter parameter

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 9: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 99

Firm TimersFirm Timers

One-shot timersOne-shot timers- - Reprogrammed for next timer interrupt

+ Soft timers (+ Soft timers (reduce interrupt overhead)

ndash Polling at convenient times (eg syscall return)

(No interrupt check timer at some check pointers(No interrupt check timer at some check pointersReduce of timer interruptsReduce of timer interruptsReduce of context switches)Reduce of context switches)

+Timer Overshoot+Timer Overshootndash Reduce variance due to soft timer uncertainty

Combination of One-shot timers and Soft timers witCombination of One-shot timers and Soft timers with system wide h system wide timer overshoottimer overshoot parameter parameter

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 10: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1010

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibilityibility

Non-preemptible kernelNon-preemptible kernel Sometime interrupt will be deferredSometime interrupt will be deferred Interrupt is disabledInterrupt is disabledIn the critical sectionIn the critical sectionPreemption latency under Linux is greater 30ms Preemption latency under Linux is greater 30ms

Preemptiable kernelPreemptiable kernel Preemptive anytime when kernel is not accessing Preemptive anytime when kernel is not accessing

shared datashared data Use spinlock to protect shared dataUse spinlock to protect shared dataPreemption latency is depend on the max time for which a Preemption latency is depend on the max time for which a

spinlock is held inside the kernelspinlock is held inside the kernel

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 11: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1111

Fine-Grained Kernel PreemptFine-Grained Kernel Preemptibility( cont)ibility( cont)

What is a Responsive KernelWhat is a Responsive Kernel Answer Answer Preemptible kernel + Explicit preemptionPreemptible kernel + Explicit preemption

Explicit insertion of preemption point aExplicit insertion of preemption point at strategic points inside the kernelt strategic points inside the kernel

Allow preemption anytime the kernel is Allow preemption anytime the kernel is not accessing shared data structurenot accessing shared data structure

Releasing spin-locks at strategic points Releasing spin-locks at strategic points in long code sectionsin long code sections

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 12: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1212

CPU SchedulingCPU Scheduling

Proportion-Period CPU SchedulingProportion-Period CPU Scheduling Provide Provide temporal protectiontemporal protection

Priority CPU SchedulingPriority CPU Scheduling Priority inversionPriority inversion Highest locking priority protocol (HLP)Highest locking priority protocol (HLP)

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 13: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1313

ExperimentExperiment

EvaluateEvaluate The behavior of time-sensitive The behavior of time-sensitive

applications running on TSLapplications running on TSL The overheads of TSLThe overheads of TSL

Environment Environment 15 GHz Pentium-4 Intel processor with 15 GHz Pentium-4 Intel processor with

512 MB memory512 MB memory Linux kernel 2416Linux kernel 2416

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 14: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1414

Latency in Real ApplicationsLatency in Real Applications((mplayer ndash a open-source audiovideo playermplayer ndash a open-source audiovideo playerProportion-period scheduler - a kernel-level ldquoapplicationrdquo)Proportion-period scheduler - a kernel-level ldquoapplicationrdquo)

Non-kernel CPU loadNon-kernel CPU load

Kernel CPU loadKernel CPU load

File System LoadFile System Load

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 15: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1515

Non-kernel CPU LoadNon-kernel CPU Load

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 16: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1616

Kernel CPU LoadKernel CPU Load

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 17: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1717

File System LoadFile System Load

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 18: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1818

Proportion-Period Proportion-Period SchedulerScheduler

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 19: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 1919

System OverheadSystem Overhead

Executing code at the newly Executing code at the newly inserted preemption pointsinserted preemption points Checking preemptionChecking preemption Executing preemption if neededExecuting preemption if needed

Executing firm timersExecuting firm timers

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 20: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 2020

Checking for PreemptionChecking for Preemption

Memory testMemory test Sequentially access a large arraySequentially access a large array

Fork testFork test Create 512 processes as soon as Create 512 processes as soon as

possiblepossible File-system testFile-system test

Repeatedly copy data from a 2MB Repeatedly copy data from a 2MB buffer to 8 MB file buffer to 8 MB file

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 21: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 2121

Firm TimersFirm Timers

Costs associated with hard timers Costs associated with hard timers exclusivelyexclusively Interrupt handling and cache pollutionInterrupt handling and cache pollution

Costs that hard and soft timers have in Costs that hard and soft timers have in commoncommon Handling timers and the executing preemption Handling timers and the executing preemption

for an expired timer threadfor an expired timer thread

Costs associated with soft timers Costs associated with soft timers exclusivelyexclusively Checking for soft timersChecking for soft timers

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 22: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 2222

Firm TimersFirm Timers

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 23: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 2323

Firm TimersFirm Timers

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 24: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 2424

Firm TimersFirm Timers

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 25: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 2525

-Firm timers lower overhead when soft-timer checks find timers -Firm timers higher overhead when soft-timer checks find nothing and timer goes off-From their work firm timers lower when more than 21 of timer checks find timer

Firm timers Discussion

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 26: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 2626

Firm Timers Discussion Firm Timers Discussion ( cont)( cont)

Nt = Nh+NsNt = Nh+Ns Total cost = CcNc+ChNh+CsNsTotal cost = CcNc+ChNh+CsNs Pure hardware = ChNtPure hardware = ChNt Total cost lt Pure hardwareTotal cost lt Pure hardware

=gtNsNc gt Cc(Ch-Cs)=gtNsNc gt Cc(Ch-Cs)

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 27: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 2727

ConclusionsConclusions

TSL can support applications needing finTSL can support applications needing fine-grained resource allocation and low late-grained resource allocation and low latency response ency response

Variations of less than 400 microseconds Variations of less than 400 microseconds under heavy CPU and file system load under heavy CPU and file system load

Overhead is lowOverhead is low NsNc gt K condition under which firm tiNsNc gt K condition under which firm ti

mers are effectivemers are effective

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING

Page 28: Supporting Time-Sensitive Applications on a GENERAL PURPOSE ( Commodity ) OS

CS533CS533 2828

Thanks for YOUR Thanks for YOUR PATIENCE In LISTENINGPATIENCE In LISTENING