introduction to realtime linux › sites › events › files › slides › ... · introduction to...
TRANSCRIPT
Introduction to Realtime Linux
Jan Altenberg
Linutronix GmbH
Jan Altenberg Linutronix GmbH 1
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?
Fast execution time?
Jan Altenberg Linutronix GmbH 3
What is Realtime?
Performance?
Jan Altenberg Linutronix GmbH 4
What is Realtime?
It's all about DETERMINISM!
Jan Altenberg Linutronix GmbH 5
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
Priority Inversion
Jan Altenberg Linutronix GmbH 12
Approaches
Dual-KernelIn-Kernel / Single Kernel
Jan Altenberg Linutronix GmbH 13
Dual-Kernel
Jan Altenberg Linutronix GmbH 14
Single-Kernel
Jan Altenberg Linutronix GmbH 15
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
RTAI
Jan Altenberg Linutronix GmbH 17
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
Xenomai
Jan Altenberg Linutronix GmbH 19
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
Preempt RT
Jan Altenberg Linutronix GmbH 24
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
What has beenmeasured?
Latency and Jitter
Jan Altenberg Linutronix GmbH 27
Latency measurement
Jan Altenberg Linutronix GmbH 28
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
Xenomai: latency userspace task
Jan Altenberg Linutronix GmbH 30
PREEMPT_RT: latency userspace task
Jan Altenberg Linutronix GmbH 31
PREEMPT_RT: latency userspace task (isolated CPU)
Jan Altenberg Linutronix GmbH 32
Latency userspace task - comparison
Jan Altenberg Linutronix GmbH 33
Latency within the Kernel
…or how to compare apples with pears!! ;-)
Jan Altenberg Linutronix GmbH 34
Latency: Kernel - Xenomai
Jan Altenberg Linutronix GmbH 35
Latency: Kernel - PREEMPT_RT
Jan Altenberg Linutronix GmbH 36
Latency: Kernel - PREEMPT_RT (isolated CPU)
Jan Altenberg Linutronix GmbH 37
Latency: Kernel - PREEMPT_RT with FIQ (fast interrupt)
Jan Altenberg Linutronix GmbH 38
Latency: Kernel - Comparison
Jan Altenberg Linutronix GmbH 39
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
Questions?
Jan Altenberg Linutronix GmbH 41