Overview of 
Linux 
real­time 
challenges
June 1, 2013
Daniel Stenberg
Email: daniel@haxx.se
Twitter: @bagder
Web: daniel.haxx.se
Blog: daniel.haxx.se/blog
●
Free Software
●
Network hacker
●
Embedded developer
●
Consultant
Agenda
What's real-time in this context?
Why is real-time still a concern?
Ways to deal with the problem
• Off to secondary hardware
• Hypervisor or AMP
• PREEMPT_RT
• CPU isolation and dynamic tick
Future?
Real­time
Real-time can mean a lot of different
things to different audiences
• Low maximum latency: below 100 us,
sometimes down to 20us
• Very low risk of every breaking that
Why is this a concern 
2013?
• Plain Linux wasn't designed to deal with low latency
• A move towards "commodity" hardware - less
special stuff means solving the problems in general
CPUs
• Linux everywhere: RTOS-solutions get moved over
from legacy systems to Linux-based
• Still a lot of stacks and applications that act in CPU
but needs to respond fast and accurately
• Sometimes a bit more requested than perhaps can
be technically motivated
What are the options?
Linux is a given.
What magic can you apply to a system
to address the problem of a low
maximum latency?
Separate dedicated HW
• A tested and proven way
• A separate small chip (with an
RTOS?) for just the time critical stuff
• ... or an FPGA
• But it adds system complexity and
price
Hypervisor with RTOS
• Isn't pure Linux
• Adds complexity
• Usually proprietary
• May reach really low latencies
One or more cores
AMP with RTOS
• Isn't pure Linux
• Adds complexity
• Often proprietary
• May reach really low latencies
Core 0 Core 1 Core 2 Core 3
The more pure Linux 
solutions
1 ­ Address and lower the worst 
case
2 ­ Avoid hitting the worst case
PREEMPT_RT
●
An off­mainline patch since 10+ years!
●
Add preemption to lower max latency
●
replace kernel spinlocks with mutexes
●
move interrupts and software interrupts to kernel 
threads
●
works on single core systems
●
Changes behavior and requires drivers to be tested
●
User­space is the same
CPU isolation 1/2
●
NOHZ, dynamic tick
●
Isolated cores == without ticks do nothing!
●
Only one thread allowed!
●
Avoiding the kernel is hard
●
Approaching mainline (3.10)
●
Requires rethinking user­space
Linux kernel
Core 0 Core 1 Core 2 Core 3
CPU isolation 2/2
Future
●
Real­time and latency remain 
interesting
●
PREEMPT_RT is not in mainline
●
NOHZ is just getting in
●
We create the future!
(from UBM Tech Electronics' Embedded Market Survery)
Work with this at Enea
Thank you
Daniel Stenberg <daniel@haxx.se>

Overview of Linux real-time challenges