Supporting Time- Sensitive Applications on a Commodity OS Presenter: Madhura S Rama

Download Report

Transcript Supporting Time- Sensitive Applications on a Commodity OS Presenter: Madhura S Rama

Supporting TimeSensitive Applications
on a Commodity OS
Ashvin Goel, Luca Abeni, Charles Krasic,
Jim Snow, Jonathan Walpole
Presenter: Madhura S Rama
Agenda




Goal
Why TSL?
Time Sensitive Requirements
TSL Implementation





Firm Timers
Fine-Grain Kernel Preemptibility
CPU Scheduling
Experimental Results
Conclusion
Goal

Integrate efficient support for time-sensitive
applications in a commodity OS without
significantly degrading the performance of
traditional applications.
Why TSL?





Soft real-time applications are time sensitive
Resources must be allocated at appropriate
times
Commodity OS provides coarse-grained
resource allocation to maximize throughput
Conflicts the needs of RTOS
Time-sensitive Linux (TSL) - provides good
performance to both time-sensitive and
throughput–oriented applications.
Time Sensitive Requirements


Timer Latency
Preemption
Latency
Interrupt
Handler
Wall-clock time Timer
event
Interrupt
Scheduling Latency
Time
Another app
Scheduled
Scheduler

Application Scheduled
(Activation)

Allocate resources at
“appropriate times”
Kernel latency – latency
between the event and
its activation
Should be low in a
time-sensitive
application
Three requirements to
reduce this latency
Different Timers




Periodic Timers
 Implemented with Periodic timer interrupts. Max 10ms latency
 Decrease in latency increases interrupt overhead
One-Shot (Hard) Timers
 Interrupts only when needed
 Timer reprogramming, fielding interrupts
Soft Timers
 Avoids interrupts
 Cost of polling, timer latency
Firm Timers
 Combines all the advantages of the above timers
 Incurs very low overhead
Three key techniques

Accurate Timing Mechanism


Responsive Kernel


Firm Timers
Lock-breaking preemptible kernel
Appropriate CPU Scheduling Algorithm


Proportion-Period Scheduler
Priority-based Scheduler
Firm Timers





Provides accurate timing mechanism with low
overhead
Combines one-shot timers with soft timers by
exposing a timer overshoot parameter
One-shot timer is programmed to fire after an
overshoot amount of time after the next timer expiry
If a system call occurs after a timer has expired but
before the one-shot timer expired, soft timers
become effective.
Reprogram the one-shot timer for the next timer
expiry – does not incur any overhead
Overshoot Accuracy vs
Overhead tradeoff
Reprogram One-shot timer
and fire the event
Poll for timer
expiry
System call
User Space
Kernel Space
Overshoot Parameter
Time-Sensitive
Application ready
For execution
Timer Latency
One-shot timer
expiry
Time
Firm Timer Implementation





Maintains a timer queue for each processor
One-shot APIC timer is programmed to generate an
interrupt at the next timer expiry event + global
overshoot value (can be made dynamic)
Soft timers enabled using non-zero timer overshoot
value
Periodic timer used when a timer needs longer
timeout
TSL use the standard POSIX interface calls modified the implementation to use firm timers
Fine-Grained Kernel Premptibility


Kernel latency increases with increase in the
length of the non-preemptible critical section
Approaches to reduce kernel latency



Explicit insertion of preemption points
Allow preemption anytime the kernel is not
accessing shared data structures
Robert Love’s lock-breaking preemptible kernel
CPU Scheduling
Uses a combination of
 Proportion-Period CPU Scheduling
 Priority CPU Scheduling
Proportion-Period CPU
Scheduling

2/3
T1
Time
Proportion

Period
1/3
T2
Proportion
Time

Provides “temporal
protection” by allocating
each task a fixed
proportion of the CPU
at each task period
Proportion can be
assigned either
statically or dynamically
using a feedback
mechanism
Improves accuracy of
scheduling analysis
Priority CPU Scheduling


Real-time priorities assigned based on
application needs
TSL schedules fixed priority tasks in the
background



Exception: Shared server tasks -> Priority
Inversion
Use Highest locking priority protocol (HLP) to
cope with priority inversion
Minimizes scheduling Latency
Latency in Real Applications
System Overhead
Conclusion


TSL can support applications requiring finegrained resource allocation and low latency
TSL is truly a general-purpose system – can
be used effectively for both time-sensitive
and throughput-oriented applications
Backup
Experimental Results
 Firm timers are effective in reducing the overhead of
one-shot timers when the ratio of number of the soft
timers that fire to the number of soft timer checks is
sufficiently large (2.1%)
 Overhead of TSL on throughput-oriented
applications is low
 Provides allocation to time-sensitive applications
with a variation of less than 400 usec even under
heavy load.