Linux as real-time system

The Open Source Automation Development Lab ran experiments on the latency of various systems running mainline Linux with real-time Kernel. They generated billions of statistical samples over more than one year of simulation time. One of the most interesting parameters measured is the total preemption latency (interrupt processing plus wakeup of a user space process). Note that we are talking about a pure Linux system here, not a real-time system that runs Linux as a task in parallel with dedicated real-time threads.

x86 VIA C7 @1000 MHz running Fedora 10 with Kernel 2.6.33.14-rt31, maximum latency 112 µs in a total of 87.8 billion cycles

The latencies of various Linux systems had shown to have small variation and not a single outlier had been detected in the whole dataset. This implies that Linux systems provide a generic feature for determinism and thus could be trusted for hard real-time tasks.

However, before you are going to wire a critical nuclear power plant controller to your Linux box, consider this:
Although the tests had been very extensive, there is still a chance that a certain condition exists where the delay exceeds the expected duration. In the tests this condition just never might have occured. I expect that the guys at OSADL have done their experiments quite accurately, so that the probability for such a case might be in the order of micro-percent. However, if you instrument a really critical system, the costs for the remaining risk are still striking.

So what do to next? Use Linux for a real-time system or not?

Use it, but don’t fully depend on it. Monitor the results. If your system has a safe state that would be entered in case a deadline is – other than expected from the measurement results – missed, Linux can be quite an attractive choice. Anyway, in order to create a dependable system, you need dependable drivers for interacting with the process environment.

For the timing issues of the operating system, the experiments and results from OSADL are extremely valuable to engineers building real-time system with Linux.

About Wilfried Elmenreich

Understanding the communication networks of the future.
This entry was posted in Dependable Systems, Embedded Software and tagged , , , , . Bookmark the permalink.

Leave a comment