What is real-time computing

In time

In short: real time

Barbara Lange, Susanne Nolte

Many embedded systems have to react in real time - reliably within a defined period of time. Such precise timing is essential for machines and medical devices.

Anyone who uses the term real-time colloquially often means “simultaneously” or “immediately”, i.e. with little delay. Information technology sees it differently: It requires a real-time system to process the data in a previously defined period and deliver results, regardless of how long this period is.

The decisive factor is reliability, not speed, although embedded systems often require reaction times of microseconds and milliseconds. If several tasks run more or less in parallel on a system, the operating system or its process scheduler must guarantee the punctuality of certain tasks, i.e. comply with the deadline set for the task.

A suitable scheduling method is the time-based Earliest Deadline First (EDF). It arranges all available tasks in ascending order according to their completion dates; the one with the earliest deadline receives the computing time. However, if the tasks are interdependent or if they use common resources, deadlocks can arise.

Real-time systems working with EDF only use preemptive multitasking. In contrast to the cooperative variant, a preemptively working scheduler does not rely on a task voluntarily releasing the processor, but rather interrupts the process, puts it to sleep and takes control again itself. Reasons for the interruption can be the expiry of the assigned time slice or the arrival of a new task with a higher priority.

A scheduler can use the priorities on the one hand to determine the size of the time slice or the frequency of the allocation of computing time. On the other hand, they can be used to organize the process sequence. Such sorting processes can either assign the priorities dynamically by reducing them with each timer tick until another task has a higher priority, or assign them statically. The latter process includes Deadline Monotonic Scheduling (DMS), which assigns the tasks according to their deadline priorities.

Always assume the worst

The minimum response time is always calculated based on the worst case, in which all delaying factors are included. Assuming a high processor load, this includes the number of cycles that the processor needs to react, the switching time from the slowest to the most urgent task and all delays caused by the operating system. All of this and the resulting guaranteed response time depend heavily on the combination of hardware and software. Non-deterministic behaviors such as swapping, certain memory accesses or hardware interrupts can mean that the worst-case scenario cannot be calculated exactly at all.

Usually a distinction is made between hard and soft real-time; in addition, there is the concept of fixed real-time. Systems that guarantee hard real-time never exceed the deadlines. If they do, they have failed. In contrast, with soft real-time, the reaction time is seen more as a statistical variable or as a guideline. With fixed real time, exceeding the deadline within a tolerance range is not considered a system failure, but the result is useless.

In further definitions, the system only has to react to a soft real-time request up to the deadline; with a hard one, the complete result must be available. Others, on the other hand, differentiate between hard and soft real-time systems in that the fluctuations (jitter) in punctuality are smaller or larger.

In different ways

Many real-time operating systems use a microkernel, which means that they only perform the absolutely necessary basic functions such as signal management, timer handling, scheduling and memory management. Everything else is in outsourced modules. This is how PikeOS from Sysgo, Neutrino from QNX, Symobi from Miray Software and ThreadX from Express Logic work, among others.

For Linux there is the Realtime Preemption Patch, which supplements the kernel with Full Realtime Preemption Support. When it comes to the question of whether Linux supports hard or only soft real-time, opinions differ [1, 2].

Real-time operating systems are facing more and more tasks: They not only have to meet the deadlines, but also distribute more and more tasks with different priorities to different processor cores. Many products promise that they will do this automatically. In safety-critical areas, they must also be certified, for example according to IEC 61508 for functional safety or for the multi-level Automotive Safety Integrity Level (ASIL). (sun)

Barbara Lange
is an IT journalist and owner of the editorial office, short and simple.

literature

  • [1] Tam Hanna; Embedded computing; Lessons to learn; Android on the way to real-time capability ?; iX 8/2014, p. 110
  • [2] Barbara Lange; Operating systems; React immediately; Free and Commercial Real-Time OS; iX 2/2015, p. 50
All links: www.ix.de/ix1603014