In embedded real-time systems, interrupts are the core mechanism for responding to external events. Whether it’s a sensor signal, peripheral input, or timer trigger, interrupts ensure that the system reacts in microseconds. The efficiency of an interrupt handling mechanism directly impacts the real-time performance of an operating system.
Based on experimental data, this article analyzes the RTLinux and VxWorks interrupt mechanisms, compares their latency, and offers optimization suggestions.
🔍 Key Takeaways #
- VxWorks ISR runs outside of task context → avoids task switching, resulting in lower latency.
- RTLinux uses a soft interrupt mechanism → more flexible, but higher latency.
- On the same hardware, VxWorks interrupt latency is about 35% lower than RTLinux.
- RTLinux can improve real-time performance by shortening interrupt-off time and optimizing scheduling.
Why Compare RTLinux and VxWorks? #
- VxWorks → A mature commercial RTOS with excellent real-time performance, widely used in aerospace, defense, and medical equipment.
- RTLinux → An open-source real-time extension to Linux, lower cost, highly customizable, suited for industrial automation and research.
For projects that need to balance performance and cost, understanding their interrupt mechanism differences is crucial for making the right system choice.
VxWorks Interrupt Handling Mechanism #
VxWorks is designed for minimal interrupt latency.
-
Execution Context
The ISR (Interrupt Service Routine) runs in a special context, outside task context, avoiding the overhead of task switching. -
Shared Interrupt Stack
All ISRs share a single interrupt stack allocated at system startup to prevent repeated memory allocation. -
ISR Limitations
- Cannot call blocking functions (e.g., acquiring a semaphore).
- Can send semaphores, messages, or events to tasks but cannot wait for them.
-
Communication Pattern
The ISR only performs minimal work to signal the interrupt; non-real-time work is deferred to a task, reducing interrupt-off time. -
Implementation
Uses an interrupt vector table, binding ISRs viaintConnect()
and relying on the BSP interrupt controller driver for fast dispatch.
RTLinux Interrupt Handling Mechanism #
RTLinux takes a different approach: the Linux kernel runs as a task under a small real-time kernel.
-
Soft Interrupt Concept
- Simulates hardware interrupt control using software variables, separating real-time and non-real-time interrupts.
- Real-time interrupts take priority over the Linux kernel.
-
Interrupt Interception
- Modifies the
cli
(disable interrupt) andsti
(enable interrupt) macros so Linux cannot block real-time interrupts.
- Modifies the
-
Real-Time Guarantee
No matter what state the Linux kernel is in (kernel mode, user mode, even with interrupts “disabled”), the real-time kernel always handles real-time interrupts first.
Interrupt Handling Flow Comparison #
Experimental Comparison: Interrupt Latency #
- Hardware Platform: Samsung S3C2440A (ARM920T core, 500 MHz)
- Method:
- Timer interrupt interval: 2 μs
- All other interrupts masked
- Measured from interrupt trigger to ISR execution using an oscilloscope
System | Avg. Interrupt Latency | Latency Difference |
---|---|---|
VxWorks | Low (Baseline) | — |
RTLinux | ~35% higher | +35% |
📊 Visual comparison:
Result: VxWorks clearly outperforms RTLinux in interrupt latency on the same platform.
Real-World Application Scenarios #
-
VxWorks
- Spacecraft attitude control
- Missile guidance systems
- High-end medical devices
-
RTLinux
- Industrial automation systems
- Robotic motion control
- Real-time data acquisition for research
Optimization Tips for RTLinux #
✅ Shorten interrupt-off time
Handle only critical operations inside the ISR; move the rest to task context.
✅ Reduce interrupt dispatch time (IDT)
Optimize interrupt vector lookup and dispatch routines.
✅ Optimize scheduler
Adjust priority policies to reduce kernel preemption time (KVT).
✅ Holistic optimization
Improve both system-level and application-level design for better real-time performance.
Conclusion #
- VxWorks → Low-latency, stable performance, ideal for extremely time-critical applications.
- RTLinux → Flexible, open-source, customizable; with proper tuning, it can meet many real-time needs.
- Borrowing VxWorks’s “fast ISR return + deferred task processing” model could significantly improve RTLinux’s interrupt performance.
📚 References #
- VxWorks Programmer’s Guide 5.4, Wind River Systems, 1999.
- Programming Environments Manual for 32-bit PowerPC Architecture, Motorola Inc., 2001.
- Ma Wen-jun, Zhao Feng-yu. Comparison and Analysis of Interrupt Mechanism Between RTLinux and VxWorks, Microcomputer Information, 2011.