Embedded software development When Software Suddenly Had to Be on Time

From Maria Beyer-Fistrich | Translated by AI 4 min Reading Time

Related Vendors

A program can operate correctly and still fail—if it reacts too late. Real-time operating systems ensure that time-critical tasks are carried out reliably. Why this has been crucial for decades becomes clear when you look back.

The NASA Mars Pathfinder probe during launch preparations in 1996. After it landed on Mars in 1997, problems in prioritizing software tasks led to repeated reboots of the onboard computer.(Source:  NASA/Kennedy Space Center)
The NASA Mars Pathfinder probe during launch preparations in 1996. After it landed on Mars in 1997, problems in prioritizing software tasks led to repeated reboots of the onboard computer.
(Source: NASA/Kennedy Space Center)

On July 4, 1997, the NASA probe Mars Pathfinder successfully landed on the Red Planet. But a few days later, its onboard computer began to restart unexpectedly.

An initially puzzling malfunction, whose cause lay hidden deep within the software architecture: a high-priority task had to wait because a less important task was blocking a shared resource. Other processes further delayed its release. The onboard computer missed a specified execution deadline and triggered a reboot. The incident illustrates a fundamental problem of embedded systems. Unlike ordinary data-processing tasks, it is not enough here to deliver a result at some point. A control program must respond to events within a certain time. Anyone who is late can fail just as surely as someone who calculates incorrectly.

PDP-11: Minicomputers such as the PDP-11 from Digital Equipment Corporation shaped computer technology in the 1970s. They were also used in industrial control and real-time applications.(Source:  Todd Dailey, CC BY-SA 2.0)
PDP-11: Minicomputers such as the PDP-11 from Digital Equipment Corporation shaped computer technology in the 1970s. They were also used in industrial control and real-time applications.
(Source: Todd Dailey, CC BY-SA 2.0)

The demand for timely responses predates the microcontroller. As early as the 1950s, digital computers began to be used in industrial monitoring and control tasks. At the beginning of the 1960s, computers were also employed directly for process control. For example, in 1962 Monsanto in the USA and ICI in the UK tested plants in which computers took over tasks that had previously been reserved for individual analog controllers. This changed the role of software. It no longer processed only measured values, but had to respond to changes of state and intervene in ongoing technical processes. Time became part of the functional requirements. Early embedded controllers did not necessarily require an operating system for this. Often a single program that repeated its tasks in a fixed sequence was sufficient. Time-critical events could be handled via interrupts. As long as the number of tasks and their dependencies remained manageable, such a system could be controlled relatively easily.

But as processors became more powerful, the requirements also grew. A computer was expected to acquire measurement data, control actuators, communicate with other devices, and at the same time monitor for faults. The various tasks had different timing requirements. A rigid program loop became increasingly unwieldy.

An OS for the correct sequence

This is where real-time operating systems came into play. A real-time operating system, or RTOS for short, provides functions to manage multiple tasks, coordinate their execution, and protect shared resources. Early commercial representatives included VRTX, developed by Hunter & Ready. In the early 1980s, such real-time kernels became established as a reusable foundation for more complex embedded applications. QNX, whose development history began in 1980, also belonged to this early generation.

What mattered was not executing as many tasks as possible at the same time. Rather, the operating system had to ensure that important tasks received CPU time in good time. With a priority-driven, preemptive scheduler, a higher-priority task that is ready to run can interrupt a less important one. But priorities alone do not solve every problem. As soon as tasks share data or resources, dependencies arise. A task may have to wait even though it actually has priority. That is exactly what proved fatal for Mars Pathfinder.

When low priority slows down the high priority

The Mars probe’s onboard computer used VxWorks, a real-time operating system from Wind River. A task for processing data from the communications bus had a high priority. However, it was blocked by a synchronisation mechanism while a lower-priority task from the meteorological measurement system was using the same resource. In between, medium-priority tasks ran, further delaying the release of the resource. The result was a so-called priority inversion: ironically, the important task did not get a chance to run in time.

Subscribe to the newsletter now

Don't Miss out on Our Best Content

By clicking on „Subscribe to Newsletter“ I agree to the processing and use of my data according to the consent form (please expand for details) and accept the Terms of Use. For more information, please see our Privacy Policy. The consent declaration relates, among other things, to the sending of editorial newsletters by email and to data matching for marketing purposes with selected advertising partners (e.g., LinkedIn, Google, Meta).

Unfold for details of your consent

The system monitoring detected the missed deadline and initiated a restart. The engineers reproduced the error on an identical test system and analysed detailed execution logs. They then changed the configuration of the synchronisation mechanism. Using so-called priority inheritance, the low-priority task temporarily received a higher priority when needed so that it could release the blocked resource more quickly. The fix was carried out from Earth. The incident made it clear that a system’s temporal correctness does not depend solely on the speed of its processor. The interactions between software tasks are just as crucial.

No maximum speed limit

A widespread misconception persists to this day: real time means that a computer has to compute particularly fast. In fact, it is primarily about predictable response times. In hard real-time systems, a specified deadline must not be missed because a late response makes the system behaviour unacceptable. In soft real-time systems, missing a deadline can be tolerable, even if it reduces the quality of the function. An RTOS supports such requirements through suitable scheduling methods, synchronisation, and mechanisms for communication between tasks. However, the temporal correctness of the entire application must be ensured through its design, analysis, and testing.

An old challenge

Today, real-time operating systems are used in, among other things, industrial control systems, vehicle control units, and medical devices. In addition to commercial systems such as QNX and VxWorks, developers also have open solutions such as FreeRTOS and Zephyr at their disposal. The hardware has fundamentally changed since the early days. Multi-core processors, extensive communication interfaces, and networked functions make embedded systems more powerful but also more complex. Modern RTOS therefore increasingly also support distributing tasks across multiple processor cores. The central question, however, has remained the same: Which task must be executed when so that a technical system functions reliably?

Six decades after the first industrial computer control systems, in many embedded applications it is therefore not only a question of whether software calculates the correct result, but also whether it delivers it on time. (mbf)