Introduction
Eclipse ThreadX (formerly Azure RTOS ThreadX) is a hard real-time OS for deeply embedded devices. It provides deterministic preemptive scheduling with sub-microsecond context switching and holds safety certifications including IEC 61508 SIL 4.
What Eclipse ThreadX Does
- Provides preemptive priority-based scheduling with constant-time context switching
- Includes companion components: FileX (file systems), NetX Duo (networking), USBX, and GUIX
- Supports ARM Cortex-M, Cortex-A, RISC-V, ARC, and Renesas RX
- Uses picokernel architecture to minimize interrupt latency
- Offers preemption-threshold scheduling to reduce unnecessary context switches
Architecture Overview
ThreadX uses a picokernel architecture with thin service layers for thread management, IPC (mutexes, semaphores, event flags, queues), memory pools, and timers. The scheduler supports 32 or 1024 priority levels. Preemption-threshold lets a thread raise its preemption level temporarily, reducing switches among cooperating threads.
Self-Hosting & Configuration
- Select the appropriate architecture port directory for your target
- Configure kernel options in tx_user.h including priority levels and timer tick rate
- Build as a static library using CMake or Make and link against your application
- Use Linux or Win32 simulation ports for development without hardware
- Add companion components by linking their respective libraries
Key Features
- Approximately 2 KB code and under 1 KB RAM minimum kernel footprint
- Deterministic O(1) scheduling with sub-microsecond context switches on Cortex-M
- Preemption-threshold scheduling unique to ThreadX
- Safety certifications: IEC 61508 SIL 4, IEC 62304 Class C, ISO 26262 ASIL D
- MIT-licensed with no runtime royalties
Comparison with Similar Tools
- FreeRTOS: Larger community and AWS integration, but lacks safety certifications and preemption-threshold scheduling
- Zephyr: Broader HAL and Linux Foundation backing, but larger footprint and less deterministic scheduling
- RIOT: IoT-focused with built-in networking and POSIX API, but not targeting safety-critical use cases
- VxWorks: Decades of aerospace deployments, but requires paid licensing unlike MIT-licensed ThreadX
FAQ
Q: Is Eclipse ThreadX free to use? A: Yes, it is MIT-licensed since its donation to the Eclipse Foundation with no runtime royalties.
Q: What happened to Azure RTOS? A: Microsoft donated it to the Eclipse Foundation in 2023, renaming it Eclipse ThreadX. The API remains the same.
Q: Can I use ThreadX for safety-critical applications? A: Yes, ThreadX holds IEC 61508 SIL 4, IEC 62304 Class C, and ISO 26262 ASIL D certifications.
Q: How does preemption-threshold work? A: Each thread has a threshold in addition to its priority. It can only be preempted by threads above the threshold, reducing switches among cooperating threads.
Sources
- Repository: https://github.com/eclipse-threadx/threadx
- Documentation: https://github.com/eclipse-threadx/rtos-docs