SlideShare a Scribd company logo
Supporting Time-Sensitive
Applications on a Commodity OS
Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow
and Jonathan Walpole
Presenter : Namhyuk Ahn
Real-Time and Time-Sensitive Applications
§ Real-Time system
• Must meet an exact (or very nearly) deadline
• Failure to meet deadline means system failures
• e.g. space shuttle, air craft..
§ Time-sensitive applications
• Applications with real-time requirements
• e.g. media player
Distributed Shared Memory: Concepts and Systems 2
Motivation
§ Needs of time-sensitive application on commodity OS increase
§ However,
§ Most commodity OS aim to maximize system throughput
• These don’t consider real-time nor time-sensitive applications
§ Most real-time OS focus on hard real-time scenario
• System throughput is decreased and limited
§ Solution: General-purpose OS should offer both properties
• Time Sensitive Linux (TS-Linux)
Distributed Shared Memory: Concepts and Systems 3
Problems of Time-Sensitive Application
§ Time-sensitive applications require timely resources allocation
§ Minimize kernel latency is important issue
• Timer latency due to inaccurate timer
• Preemption latency due to threads executing in kernel cannot be preempted
• Scheduling latency is time taken to schedule the event
Distributed Shared Memory: Concepts and Systems 4
Solutions
§ TSL improves three keys causing latency
• Timer latency → Accurate timer mechanism
► Firm timer
• Preemption latency → Responsive kernel
► Lock-breaking preemptible kernel
• Scheduling latency → Effective scheduling
► Proportion-period scheduler
► Priority-based scheduler
§ TSL is version of Linux that can:
• Effectively run time-sensitive applications
• Effectively run throughput applications
• Be implemented without modifying existing applications
Distributed Shared Memory: Concepts and Systems 5
Timer Mechanism
§ Periodic timers
• Timer interrupts periodically; Max timer latency equals to the period
• Reducing latency increase interrupt overhead
§ One-shot timers
• Interrupts only when needs
• Cost of reprogramming
• High accuracy but high interrupt overhead
§ Example: Two task with periods 5, 7ms and run 35ms
• Periodic timers with period of 1ms
► Maximum latency is 1ms; 35 interrupts
• One-shot timer
► Relatively small latency; 11 interrupts (5ms, 7ms, 10ms, 14ms ..)
Distributed Shared Memory: Concepts and Systems 6
Timer Mechanism
§ Soft timers
• One-shot timer have interrupt overhead
• Reduce cost of context switch caused by interrupts
• But, timer latency is increase
§ Procedure
1. At some points, system will arrive at “trigger states”
o End of system call, exception handler or interrupt handler
o CPU idle
2. This invoke event handler; there is no overhead since already context-
switched
3. Soft timer checks for any pending events without hardware timer cost
Distributed Shared Memory: Concepts and Systems 7
Accurate Timer Mechanism – Firm timer
§ Firm timers
• Combine all the advantages of three timers before
• Overshoot parameter: bridge between one-shot and soft timer
• This makes unnecessary interrupts avoided
• High overshoot = soft; low = one-shot
Distributed Shared Memory: Concepts and Systems 8
Time
One-shot
timer expired
Overshoot
syscall
Programmed
One-shot interrupt
Dispatch and reprogram
one-shot timer
Interrupt does not occured
In case no syscall in overshot period, it perform as one-shot timer
Responsive Kernel
§ Kernel is responsive when non-preemptible section is small
§ The case scheduler is not able to run
• Interrupts is disabled (has to ready in ready-queue)
• Another thread is executing critical section in kernel
§ So, length of non-preemptible section is important
• But traditional commodity kernel disable preemption for the entire kernel
Distributed Shared Memory: Concepts and Systems 9
Fine-grained Preemptible Kernel
§ Explicit preemption
• Explicit insertion of preemption points inside the kernel
• Kernel explicitly yields CPU to scheduler when meet preemption point
• Has to be manually placed preemption points
§ Anytime preemption
• Allow preemption anytime kernel not manipulating shared data structure
• Shared kernel data must be protected using mutex or spinlock
• High latency when spinlock are held long time
Distributed Shared Memory: Concepts and Systems 10
Fine-grained Preemptible Kernel
§ Lock-breaking preemption
• Combine the above ideas
• TSL use lock-breaking preemption
• Split long spinlock section to multiple acquire-release points
Distributed Shared Memory: Concepts and Systems 11
acq()
... // manipulate shared data
rel()
… // preemptive kernel, check for expired scheduler
reacq()
…
rel()
acq()
…
rel()
Scheduling
§ Highest priority goes first
• Very simple
• But misbehaving and high-priority process can starve all other tasks
• Temporal protection issue:
► don’t make misbehaved task consuming too much execution time
Distributed Shared Memory: Concepts and Systems 12
Scheduling
§ Proportion-period scheduling
• Each task is allocated a fixed proportion
of CPU
• Provide temporal protection
• Q and T are adjustable by feedback
controller mechanism
• After executing for time Q, it block until
next T (or schedule for non-TS task)
13
T1
T2
2/3
1/3
Proportion Q
Proportion Q
Time
Period T
Scheduling
§ TSL combines proportion-based and fixed priority scheduler
• Fixed priority schedule doesn’t guarantee temporal protection
• Make proportion Q with respect to fixed priority
• Sounds good, but few exceptions
Distributed Shared Memory: Concepts and Systems 14
Scheduling
§ Exception case:
C1
Server
High priority
Low priority
Time
C1 scheduled Server
run
C2 Mid priority
Blocking call
C1 Ready to runC2
run
C2 preempts server
: Priority inversion for C1
Scheduling
§ Exception case:
C1
Server
High priority
Low priority
Time
C1 scheduled Server
run
C2 Mid priority
Blocking call
C1 Ready to run
Highest locking priority (HLP):
When a task acquires a resource, it gets the
highest priority that can acquire this resource
e.g. server task is now priority of C1
Evaluation
§ Setup:
• Modified version of Linux 2.4.16
• + Firm timer, lock-breaking and proportion-period scheduler
• 1.5 GHz Intel Pentium 4
• 512 MB RAM
Distributed Shared Memory: Concepts and Systems 17
Evaluation
§ Micro benchmarks
• Evaluate timer latency and preemption latency
• Measure time that process actually sleep in time-sensitive process using
nanosleep()
§ Timer latency
• Standard Linux: 10ms
• + firm timer: < 1ms
§ Preemption latency
• Evaluate when number of system loads are run in background
• Linux + firm timer: > 5ms
• + lock-break: < 1ms
Distributed Shared Memory: Concepts and Systems 18
Evaluation
§ Evaluation on real-world application
• Measure audio/video sync skew in Mplayer (media player)
§ Evaluate under three scenarios
1. Non-kernel CPU load
o User-level stress test is run in the background
2. Kernel CPU load
o Large memory buffer is copied to a file (user to kernel space)
3. File-system load
o Large directory is copied
Distributed Shared Memory: Concepts and Systems 19
Evaluation
§ Non-kernel CPU load
Distributed Shared Memory: Concepts and Systems 20
Evaluation
§ Kernel CPU load
Distributed Shared Memory: Concepts and Systems 21
Evaluation
§ File-system load
Distributed Shared Memory: Concepts and Systems 22
Evaluation
§ Preemption overhead
• Memory access (access 128MB array thus produce page fault)
► TSL overhead: 0.42% std 0.18%
• Fork (create 512 processes)
► TSL overhead: 0.53% std 0.06%
• File system (copy data from 2MB user buffer to 8MB file)
► TSL overhead: no significant overhead
Distributed Shared Memory: Concepts and Systems 23
Evaluation
§ Firm timer overhead
Distributed Shared Memory: Concepts and Systems 24
Conclusion
§ TSL provides real-time support for commodity OS by,
• Firm timer
• Responsive kernel
• Proportion-based scheduler
§ TSL can be used in both time-sensitive and throughput oriented app
Distributed Shared Memory: Concepts and Systems 25
Discussion topics
§ Rethinking the Real-time
• Requirements for RT system
► What are needed to ensure exact (or near-exact) timing?
• Example of time-sensitive applications have to run in commodity OS
• How to bring RT concept to commodity OS efficiently?
Distributed Shared Memory: Concepts and Systems 26
Discussion topics
§ What features should we consider to build Distributed RTOS?
Distributed Shared Memory: Concepts and Systems 27

More Related Content

PPTX
Lecture 4 process cpu scheduling
PDF
Overview of Linux real-time challenges
PDF
Process Scheduler and Balancer in Linux Kernel
PDF
Ch6 cpu scheduling
PDF
Mastering Real-time Linux
PDF
cpu scheduling by shivam singh
PDF
Real Time Operating System Concepts
PPTX
Real time Linux
Lecture 4 process cpu scheduling
Overview of Linux real-time challenges
Process Scheduler and Balancer in Linux Kernel
Ch6 cpu scheduling
Mastering Real-time Linux
cpu scheduling by shivam singh
Real Time Operating System Concepts
Real time Linux

What's hot (20)

PDF
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
PPTX
Preempt_rt realtime patch
PDF
Linux Preempt-RT Internals
PDF
HKG15-305: Real Time processing comparing the RT patch vs Core isolation
PDF
Operating Systems 1 (10/12) - Scheduling
PPT
Window scheduling algorithm
PDF
CPU Scheduling
PDF
Process Synchronization
PDF
Operating System-Ch8 memory management
PPT
The Windows Scheduler
PPT
cpu scheduling in os
PDF
Real-time soultion
PPT
Real time system tsp
PPT
cpu scheduling OS
PDF
Solving Real-Time Scheduling Problems With RT_PREEMPT and Deadline-Based Sche...
PDF
Process Management
PPTX
Lecture 2 process
PDF
Process scheduling (CPU Scheduling)
PDF
Rtos part2
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Preempt_rt realtime patch
Linux Preempt-RT Internals
HKG15-305: Real Time processing comparing the RT patch vs Core isolation
Operating Systems 1 (10/12) - Scheduling
Window scheduling algorithm
CPU Scheduling
Process Synchronization
Operating System-Ch8 memory management
The Windows Scheduler
cpu scheduling in os
Real-time soultion
Real time system tsp
cpu scheduling OS
Solving Real-Time Scheduling Problems With RT_PREEMPT and Deadline-Based Sche...
Process Management
Lecture 2 process
Process scheduling (CPU Scheduling)
Rtos part2
Ad

Similar to Supporting Time-Sensitive Applications on a Commodity OS (20)

PPTX
Process scheduling &amp; time
PPTX
Insider operating system
PPTX
How Operating system works.
PPTX
CONTEXT SWITCHING,PREEMPTIVE,NONPREEMPTIVE.pptx
PDF
Section05 scheduling
PPTX
PPTX
Thread-Preemption-and-Preemptive-Task-Scheduling.pptx(3).pptx
PPTX
Lec 9-os-review
PPT
Real-Time Operating Systems
PPT
Memory Management in Operating Systems for all
PDF
OS Lecture 01 Introductiodg (Slides).pdf
PDF
Real time operating system
PPTX
Real Time Systems
PPT
10-MultiprocessorScheduling chapter8.ppt
PPTX
참여기관_발표자료-국민대학교 201301 정기회의
PDF
MK Sistem Operasi.pdf
PPT
06-scheduling.ppt including multiple CPUs
PPT
Nbvtalkatjntuvizianagaram
PPTX
Real Time Operating Systems Basic Definitions
PPTX
RTOS_Keywords_with basic Definitions.pptx
Process scheduling &amp; time
Insider operating system
How Operating system works.
CONTEXT SWITCHING,PREEMPTIVE,NONPREEMPTIVE.pptx
Section05 scheduling
Thread-Preemption-and-Preemptive-Task-Scheduling.pptx(3).pptx
Lec 9-os-review
Real-Time Operating Systems
Memory Management in Operating Systems for all
OS Lecture 01 Introductiodg (Slides).pdf
Real time operating system
Real Time Systems
10-MultiprocessorScheduling chapter8.ppt
참여기관_발표자료-국민대학교 201301 정기회의
MK Sistem Operasi.pdf
06-scheduling.ppt including multiple CPUs
Nbvtalkatjntuvizianagaram
Real Time Operating Systems Basic Definitions
RTOS_Keywords_with basic Definitions.pptx
Ad

More from NamHyuk Ahn (7)

PDF
TensorFlow Tutorial
PDF
Generative Adversarial Network (+Laplacian Pyramid GAN)
PDF
Single Shot Multibox Detector
PDF
Multimodal Residual Learning for Visual QA
PDF
Google's Multilingual Neural Machine Translation System
PDF
DeconvNet, DecoupledNet, TransferNet in Image Segmentation
PDF
Case Study of Convolutional Neural Network
TensorFlow Tutorial
Generative Adversarial Network (+Laplacian Pyramid GAN)
Single Shot Multibox Detector
Multimodal Residual Learning for Visual QA
Google's Multilingual Neural Machine Translation System
DeconvNet, DecoupledNet, TransferNet in Image Segmentation
Case Study of Convolutional Neural Network

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation theory and applications.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Spectroscopy.pptx food analysis technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Empathic Computing: Creating Shared Understanding
Electronic commerce courselecture one. Pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Machine learning based COVID-19 study performance prediction
Encapsulation theory and applications.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
sap open course for s4hana steps from ECC to s4
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Spectroscopy.pptx food analysis technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
Understanding_Digital_Forensics_Presentation.pptx
Empathic Computing: Creating Shared Understanding

Supporting Time-Sensitive Applications on a Commodity OS

  • 1. Supporting Time-Sensitive Applications on a Commodity OS Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow and Jonathan Walpole Presenter : Namhyuk Ahn
  • 2. Real-Time and Time-Sensitive Applications § Real-Time system • Must meet an exact (or very nearly) deadline • Failure to meet deadline means system failures • e.g. space shuttle, air craft.. § Time-sensitive applications • Applications with real-time requirements • e.g. media player Distributed Shared Memory: Concepts and Systems 2
  • 3. Motivation § Needs of time-sensitive application on commodity OS increase § However, § Most commodity OS aim to maximize system throughput • These don’t consider real-time nor time-sensitive applications § Most real-time OS focus on hard real-time scenario • System throughput is decreased and limited § Solution: General-purpose OS should offer both properties • Time Sensitive Linux (TS-Linux) Distributed Shared Memory: Concepts and Systems 3
  • 4. Problems of Time-Sensitive Application § Time-sensitive applications require timely resources allocation § Minimize kernel latency is important issue • Timer latency due to inaccurate timer • Preemption latency due to threads executing in kernel cannot be preempted • Scheduling latency is time taken to schedule the event Distributed Shared Memory: Concepts and Systems 4
  • 5. Solutions § TSL improves three keys causing latency • Timer latency → Accurate timer mechanism ► Firm timer • Preemption latency → Responsive kernel ► Lock-breaking preemptible kernel • Scheduling latency → Effective scheduling ► Proportion-period scheduler ► Priority-based scheduler § TSL is version of Linux that can: • Effectively run time-sensitive applications • Effectively run throughput applications • Be implemented without modifying existing applications Distributed Shared Memory: Concepts and Systems 5
  • 6. Timer Mechanism § Periodic timers • Timer interrupts periodically; Max timer latency equals to the period • Reducing latency increase interrupt overhead § One-shot timers • Interrupts only when needs • Cost of reprogramming • High accuracy but high interrupt overhead § Example: Two task with periods 5, 7ms and run 35ms • Periodic timers with period of 1ms ► Maximum latency is 1ms; 35 interrupts • One-shot timer ► Relatively small latency; 11 interrupts (5ms, 7ms, 10ms, 14ms ..) Distributed Shared Memory: Concepts and Systems 6
  • 7. Timer Mechanism § Soft timers • One-shot timer have interrupt overhead • Reduce cost of context switch caused by interrupts • But, timer latency is increase § Procedure 1. At some points, system will arrive at “trigger states” o End of system call, exception handler or interrupt handler o CPU idle 2. This invoke event handler; there is no overhead since already context- switched 3. Soft timer checks for any pending events without hardware timer cost Distributed Shared Memory: Concepts and Systems 7
  • 8. Accurate Timer Mechanism – Firm timer § Firm timers • Combine all the advantages of three timers before • Overshoot parameter: bridge between one-shot and soft timer • This makes unnecessary interrupts avoided • High overshoot = soft; low = one-shot Distributed Shared Memory: Concepts and Systems 8 Time One-shot timer expired Overshoot syscall Programmed One-shot interrupt Dispatch and reprogram one-shot timer Interrupt does not occured In case no syscall in overshot period, it perform as one-shot timer
  • 9. Responsive Kernel § Kernel is responsive when non-preemptible section is small § The case scheduler is not able to run • Interrupts is disabled (has to ready in ready-queue) • Another thread is executing critical section in kernel § So, length of non-preemptible section is important • But traditional commodity kernel disable preemption for the entire kernel Distributed Shared Memory: Concepts and Systems 9
  • 10. Fine-grained Preemptible Kernel § Explicit preemption • Explicit insertion of preemption points inside the kernel • Kernel explicitly yields CPU to scheduler when meet preemption point • Has to be manually placed preemption points § Anytime preemption • Allow preemption anytime kernel not manipulating shared data structure • Shared kernel data must be protected using mutex or spinlock • High latency when spinlock are held long time Distributed Shared Memory: Concepts and Systems 10
  • 11. Fine-grained Preemptible Kernel § Lock-breaking preemption • Combine the above ideas • TSL use lock-breaking preemption • Split long spinlock section to multiple acquire-release points Distributed Shared Memory: Concepts and Systems 11 acq() ... // manipulate shared data rel() … // preemptive kernel, check for expired scheduler reacq() … rel() acq() … rel()
  • 12. Scheduling § Highest priority goes first • Very simple • But misbehaving and high-priority process can starve all other tasks • Temporal protection issue: ► don’t make misbehaved task consuming too much execution time Distributed Shared Memory: Concepts and Systems 12
  • 13. Scheduling § Proportion-period scheduling • Each task is allocated a fixed proportion of CPU • Provide temporal protection • Q and T are adjustable by feedback controller mechanism • After executing for time Q, it block until next T (or schedule for non-TS task) 13 T1 T2 2/3 1/3 Proportion Q Proportion Q Time Period T
  • 14. Scheduling § TSL combines proportion-based and fixed priority scheduler • Fixed priority schedule doesn’t guarantee temporal protection • Make proportion Q with respect to fixed priority • Sounds good, but few exceptions Distributed Shared Memory: Concepts and Systems 14
  • 15. Scheduling § Exception case: C1 Server High priority Low priority Time C1 scheduled Server run C2 Mid priority Blocking call C1 Ready to runC2 run C2 preempts server : Priority inversion for C1
  • 16. Scheduling § Exception case: C1 Server High priority Low priority Time C1 scheduled Server run C2 Mid priority Blocking call C1 Ready to run Highest locking priority (HLP): When a task acquires a resource, it gets the highest priority that can acquire this resource e.g. server task is now priority of C1
  • 17. Evaluation § Setup: • Modified version of Linux 2.4.16 • + Firm timer, lock-breaking and proportion-period scheduler • 1.5 GHz Intel Pentium 4 • 512 MB RAM Distributed Shared Memory: Concepts and Systems 17
  • 18. Evaluation § Micro benchmarks • Evaluate timer latency and preemption latency • Measure time that process actually sleep in time-sensitive process using nanosleep() § Timer latency • Standard Linux: 10ms • + firm timer: < 1ms § Preemption latency • Evaluate when number of system loads are run in background • Linux + firm timer: > 5ms • + lock-break: < 1ms Distributed Shared Memory: Concepts and Systems 18
  • 19. Evaluation § Evaluation on real-world application • Measure audio/video sync skew in Mplayer (media player) § Evaluate under three scenarios 1. Non-kernel CPU load o User-level stress test is run in the background 2. Kernel CPU load o Large memory buffer is copied to a file (user to kernel space) 3. File-system load o Large directory is copied Distributed Shared Memory: Concepts and Systems 19
  • 20. Evaluation § Non-kernel CPU load Distributed Shared Memory: Concepts and Systems 20
  • 21. Evaluation § Kernel CPU load Distributed Shared Memory: Concepts and Systems 21
  • 22. Evaluation § File-system load Distributed Shared Memory: Concepts and Systems 22
  • 23. Evaluation § Preemption overhead • Memory access (access 128MB array thus produce page fault) ► TSL overhead: 0.42% std 0.18% • Fork (create 512 processes) ► TSL overhead: 0.53% std 0.06% • File system (copy data from 2MB user buffer to 8MB file) ► TSL overhead: no significant overhead Distributed Shared Memory: Concepts and Systems 23
  • 24. Evaluation § Firm timer overhead Distributed Shared Memory: Concepts and Systems 24
  • 25. Conclusion § TSL provides real-time support for commodity OS by, • Firm timer • Responsive kernel • Proportion-based scheduler § TSL can be used in both time-sensitive and throughput oriented app Distributed Shared Memory: Concepts and Systems 25
  • 26. Discussion topics § Rethinking the Real-time • Requirements for RT system ► What are needed to ensure exact (or near-exact) timing? • Example of time-sensitive applications have to run in commodity OS • How to bring RT concept to commodity OS efficiently? Distributed Shared Memory: Concepts and Systems 26
  • 27. Discussion topics § What features should we consider to build Distributed RTOS? Distributed Shared Memory: Concepts and Systems 27