280 likes | 288 Views
This paper discusses techniques for improving the performance of time-sensitive applications on a general purpose operating system, such as Linux. The authors propose a combination of firm timers, fine-grained kernel preemption, and priority-based scheduling to reduce latency and improve responsiveness. The experimental results show that these techniques can significantly enhance the performance of time-sensitive applications.
E N D
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 CS533
Real-Time & General Purpose OS’s - Real-Time OS: VxWorks, QNX, LynxOS, eCos,DeltaOS, PSX,embOS, ... - GPOS: no support for real-time - applications, focus on ‘fairness’. - BUT, people love GPOSs, e.g., Linux: CS533
Outline • Introduction • Implementing Time-Sensitive Linux • Experiment • Conclusions CS533
Introduction • Time-sensitive Applications ( Ex:multimedia, soft real-time applications. ) • High precision timing facility • Well designed preemptible kernel • Appropriate scheduling technique • Time-Sensitive Requirement • Timing Mechanism • Responsive Kernel • CPU Scheduling Algorithm CS533
Paper’s Contribution • Situation: Linux (and many other OS’s) cannot handle real-time applications • Hypothesis: a few techniques can overcome the limitations of Linux – Firm timer (high resolution) – Fine-grain kernel preemption – Priority and reservation-based scheduling • Good performance and low overhead CS533
Problems and Solutions • Firm Timer reduces timer latency – Low overhead important • Fine-grain kernel preemption reduces preemption latency – Responsive kernel • Good schedulers reduce scheduling latency – Proportion-period scheduler CS533
Kernel Latency CS533
TSL Introduction • Integrated techniques of TSL • Firm timers • One-shot timers • Soft timers • Timer Overshoot • Fine-grained kernel preemptibility • CPU Scheduling • Priority-based • Proportion-period CS533
Firm Timers • One-shot timers - Reprogrammed for next timer interrupt • + Soft timers (reduce interrupt overhead) – Polling at convenient times (e.g., syscall return) (No interrupt, check timer at some check pointers Reduce # of timer interrupts Reduce # of context switches) • +Timer Overshoot – Reduce variance due to soft timer uncertainty • Combination of One-shot timers and Soft timers with system wide timer overshoot parameter CS533
Fine-Grained Kernel Preemptibility Non-preemptible kernel • Sometime interrupt will be deferred • Interrupt is disabled In the critical section Preemption latency under Linux is greater 30ms Preemptiable kernel • Preemptive anytime when kernel is not accessing shared data • Use spinlock to protect shared data Preemption latency is depend on the max time for which a spinlock is held inside the kernel CS533
Fine-Grained Kernel Preemptibility( cont) • What is a Responsive Kernel? Answer: Preemptible kernel + Explicit preemption • Explicit insertion of preemption point at strategic points inside the kernel • Allow preemption anytime the kernel is not accessing shared data structure • Releasing spin-locks at strategic points in long code sections CS533
CPU Scheduling • Proportion-Period CPU Scheduling • Provide temporal protection • Priority CPU Scheduling • Priority inversion • Highest locking priority protocol (HLP) CS533
Experiment • Evaluate • The behavior of time-sensitive applications running on TSL • The overheads of TSL • Environment : • 1.5 GHz Pentium-4 Intel processor with 512 MB memory • Linux kernel 2.4.16 CS533
Latency in Real Applications(mplayer – a open-source audio/video playerProportion-period scheduler - a kernel-level “application”) Non-kernel CPU load Kernel CPU load File System Load CS533
Non-kernel CPU Load CS533
Kernel CPU Load CS533
File System Load CS533
System Overhead • Executing code at the newly inserted preemption points • Checking preemption • Executing preemption if needed • Executing firm timers CS533
Checking for Preemption • Memory test • Sequentially access a large array • Fork test • Create 512 processes as soon as possible • File-system test • Repeatedly copy data from a 2MB buffer to 8 MB file CS533
Firm Timers • Costs associated with hard timers exclusively • Interrupt handling and cache pollution • Costs that hard and soft timers have in common • Handling timers and the executing preemption for an expired timer thread • Costs associated with soft timers exclusively • Checking for soft timers CS533
Firm Timers CS533
Firm Timers CS533
Firm Timers CS533
Firm timers Discussion -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 2.1% of timer checks find timer CS533
Firm Timers Discussion ( cont) • Nt = Nh+Ns • Total cost = CcNc+ChNh+CsNs • Pure hardware = ChNt • Total cost < Pure hardware=>Ns/Nc > Cc/(Ch-Cs) CS533
Conclusions • TSL can support applications needing fine-grained resource allocation and low latency response • Variations of less than 400 microseconds under heavy CPU and file system load • Overhead is low • Ns/Nc > K condition under which firm timers are effective CS533