Military Embedded Systems

Real hardware, real software, real-time performance: Real-Time Linux

Blog

February 25, 2016

Interactions with the physical world can be tricky ? even dangerous! Let's say you have an Internet of Things (IoT) application controlling a chemical process - perhaps exotic chemicals for an aerospace mission. The IoT devices include sensors for temperature, pressure, flow rate, and tank levels and actuators for pumps, heaters and valves ? including a dump valve ready to vent high pressure. In this situation it's likely you would have analysis and reporting software running, be receiving sensor readings, and have control of the various pumps, heaters and valves. With IoT, computing can be pushed to the edge via gateways and controllers often running sophisticated applications.

Now, here's where the danger comes in: let's assume the chemical reactions can get out of control with little or no warning, producing a sudden catastrophic spike in pressure. Just to make things interesting, we'll add a high pressure reaction vessel which can fail catastrophically under too much pressure. In fact, if the pressure exceeds 5,000 psi, the dump valve must be opened within a half second of a pressure event to prevent rupture.

Normally there would be no problem responding to this sudden pressure event. But what happens if this control system were heavily loaded - reports were being generated, a garbage collector process was running, normal temperature and pressure events were being received, and users were interacting with the system - at the same time the chemical reaction producing the over-pressure situation occurred? A heavily loaded control system might not be able to respond in time to prevent damage.

The answer is to use an operating system – and applications – that are designed to enable important events to preempt less important activities. This is where Real-Time Linux (RT Linux) comes in: a Linux that has been extended to predictably respond to critical events.

RT Linux delivers a familiar environment to developers, system administrators, and users. It uses standard Linux drivers, devices, networking, and interfaces. RT Linux, running real-time applications, meets the requirements of many real-time applications while running on modern processors. It provides a modern development environment, and integrates into modern distributed systems.

At its heart, the concept of real-time is simple – respond to high priority events within a predictable amount of time. Note that this doesn't say quickly, it says predictably. The secret of a successful real- time implementation is to start with predictability and then size the system to deliver the required performance.

RT Linux is an extension of standard Linux that addresses predictability in several ways. First, it provides extensive pre-emption support so that high priority tasks can take over control of the system from lower priority tasks. It also uses high resolution timers so that there is less time between points where a higher priority task can take control of the system. Finally, it employs enhanced interrupts that enable critical events to take priority over less important events.

In the example above, RT Linux would handle the normal workloads in the usual way – reports, analytics, garbage collection, user interaction, etc. would all behave the same as they ordinarily do. Messages from the sensors and actuators would be given priority over other tasks, to handle them in a consistent, predictable amount of time. The emergency over-pressure message, and the command to the dump valve would take priority over everything else and be handled immediately – no matter what else was going on in the system.

If Linux can handle real-time, you may wonder why dedicated real-time operating systems are still used. A dedicated real-time OS can offer stronger deterministic behavior, especially on deterministic hardware. This has been a strong factor in the past.

However, modern systems – multi-core processors with rich instruction sets, multi-issue/out-of-order processing, multi-level cache, and complex I/O subsystems – have trouble with deterministic behavior. It is extremely difficult on these systems to use traditional approaches to prove a task will be completed in a specified amount of time. Modern hardware also uses modern software – including powerful programming languages, complex frameworks and libraries, rich development and debugging tools – which all conspire to make it difficult to prove determinism.

While modern systems make it difficult to use formal techniques to prove deterministic performance, experience shows they can do an excellent job in delivering real-time responsiveness. Careful design, comprehensive testing, and extensive benchmarking are ways to enable a system to meet real-time application needs, even if performance can't be proven using the formal methods that have traditionally been used to analyze real-time systems.

For many applications, we can rethink dedicated real-time operating systems and take advantage of the standardization, power, and flexibility that RT Linux has to offer. In fact, the question isn't whether or not to use Linux for real-time applications, it's which RT Linux to use: a stripped down minimalist Linux for embedded applications, a full function enterprise Linux for sophisticated applications, or perhaps one you already have experience with.

 

Featured Companies

Red Hat

100 East Davie Street
Raleigh, NC 27601