Overview
..1 What is Realtime?
..2 Linux and Realtime
..3 Results: Which latencies can be achieved with the differentapproaches?
..4 Conclusion
Jan Altenberg Linutronix GmbH 2
What is Realtime?
Correctness means execution at the correct timeMissing the timeslot will lead to an error condition
Jan Altenberg Linutronix GmbH 6
Realtime
Remember!Missing the timeslot will lead to an error condition
Jan Altenberg Linutronix GmbH 7
Realtime
Missing the timelinewill cause a damage to your machine or even a person might get hurt:
Jan Altenberg Linutronix GmbH 8
What about ''Softrealtime''?
…PLEASE PLEEAAASSEEE forget about this word!!! :)
Jan Altenberg Linutronix GmbH 9
Who is using it?
industry / automationmultimedia systemsaerospacefinancial services…
Jan Altenberg Linutronix GmbH 10
Requirements
Deterministic timing behaviourPreemptionPriority Inheritance / Priority Ceiling
Jan Altenberg Linutronix GmbH 11
RTAI
Prof. Paolo Mantegazza, University of MilanoDual-Kernel approachRealtime in kernelspaceRealtime in userspace very limitedDesign goal: Lowest latenciesSupported platforms: x86, x86_64, and a couple of ARM platforms
Jan Altenberg Linutronix GmbH 16
Xenomai
Founded 2001Realtime in userspaceSkins can emulate the API of different RTOSesDual-Kernel approachSupported platforms: x86, x86_64, PowerPC, ARM, ia64
Jan Altenberg Linutronix GmbH 18
Known issues of dual-kernel approaches
Special APISpecial tools and librariesMicrokernel needs to be ported for new HW and new Linux versionsBad scaling on big platforms
Jan Altenberg Linutronix GmbH 20
Preempt RT
In-Kernel approachFounded by: Thomas Gleixner, Ingo MolnarHuge communityMost of the features already made it into ''Mainline''POSIX realtimeHighly accepted in the community
Jan Altenberg Linutronix GmbH 21
Preempt RT undMainline
''Controlling a laser with Linux is crazy, but everyone in this room is crazyin his own way. So if you want to use Linux to control an industrialwelding laser, I have no problem with your using Preempt RT'' - LinusTorvalds auf dem Kernel Summit 2006
Jan Altenberg Linutronix GmbH 22
How Preempt RT brings Realtime to Linux?
Remember once again…Preemption is the most important requirement for a Realtime System
Jan Altenberg Linutronix GmbH 23
How Preempt RT brings Realtime to Linux?
Locking Primitives: Spinlocks are replaced by RT Mutexes. RawSpinlocks behave like the original Spinlocks.Interrupt Handlers run in a kernel thread
Jan Altenberg Linutronix GmbH 23
Latency Measurements on a Cortex A9 platform
ARM Cortex A9 SOC (Altera Cyclone V)System load: 100% CPU load with hackbenchIRQ tests at 10 kHz with the OSADL Latency BoxTest duration 12h
Jan Altenberg Linutronix GmbH 25
Load scenario: hackbench
Starts n groups of 20 clients and 20 serversEach client sends 100 messages to each server via a socketconnection
Jan Altenberg Linutronix GmbH 26
Userspace Latency: The most important usecase
The most important usecase is the latency of a userspace task. Usually auserspace task needs to be synced with an external event.
Jan Altenberg Linutronix GmbH 29
Latency within the Kernel
…or how to compare apples with pears!! ;-)
Jan Altenberg Linutronix GmbH 34
Conclusion
PREEMPT_RT became the de-facto standard for Realtime LinuxIntegration of PREEMPT_RT in Mainline LinuxSimple usage of PREEMPT_RTMicrokernels are hard to handleFor the most common use-cases the Microkernels do NOT havebetter latenciesFIQs offer fast latencies, but are hard to handle
Jan Altenberg Linutronix GmbH 40