Getting High Performance Real-Time out of Linux

What do you do when you need to use Linux but you also need your runtime to provide true real-time characteristics? There are several options, of course, with different sets of pros and cons, but the fact is that Linux was never designed for real-time systems so there is really no magic, just innovations.

By Tomas Hedqvist

So... what to do?

1. You can use the PREEMPT_RT patch to make the Linux preemptive to varying degrees. With full preemption turned on, you will have moderate real-time characteristics suitable for systems that does not require the absolute highest performance.

2. Or you can pin threads to specific cores avoiding any kernel activity on that specific core, at least if you also implement the NO_HZ patch. This will provide quite good real-time characteristics for single-threaded applications but any system calls from the pinned thread will scrap determinism completely. For single-threaded poll loops this solution could work quite well and provide good real-time characteristics.

3. Then there is the option of partitioning on OS level using a type 1 hypervisor. Such a solution will have one domain for Linux to run in and one domain for a real-time executive to run in. One of the beauties of this solution is that there is no need to patch the Linux kernel, you can use a standard SMP Linux and still get excellent real-time characteristics.

Unlike other ways to provide real-time to Linux, this allows a scalable and flexible solution with excellent real-time characteristics and performance. The number of cores that should be assigned to Linux and the real-time executive respectively is decided at boot time which makes it very easy to adopt it to new applications.

How Enea can help

The really good news is that we at Enea have been researching this topic and developed a framework that we can use to create solutions with Linux accelerated with a real-time executive. It uses a type 1 hypervisor to provide strong and clean isolation between the Linux domain and the real-time domain, while enabling resources to be shared between the two domains. Shared resources can be both OS services such as IPC or file system, or hardware resources such as NICs and external memories.

A little more complex to set-up and configure from scratch, but once the initial phase is completed, it will offer a powerful platform adding real-time capabilities to Linux. This is where our framework and expertise comes into the picture. At Enea we provide deployment-ready solutions based on our framework, and we support our customers' solutions throughout their products' lifecycles.

Find our more on about Enea's solutions for real-time acceleration of Linux or read the white paper on enabling real-time in Linux.