## 1. Introduction

In this tutorial, we’ll study real-time systems.

## 2. Real-Time Systems

We define a system as real-time if it delivers the output quickly after reading input. The period, which we also call a deadline, is specified to be so short that it appears the system is responding immediately.

An example is a flight control system. Such a system is real-time because all its sub-systems must work quickly for smooth functioning. Otherwise, there would be fatal failures. For instance, while touching down, an airplane’s wheels must open and start moving fast, or else there could be a crash.

By looking at the timing requirements and response tolerance, we categorize real-time systems as hard or soft:

## 3. Hard Real-Time Systems

A hard real-time system has a non-negotiable (hard) requirement to finish its execution and gives results within a short time frame. In case a task misses its deadline, the complete system collapses. In other words, there’s no flexibility in time constraints.

Air traffic control system is one of the most popular examples of hard real-time systems. Here, all sub-systems that control the movement of an airplane from its starting time till its touchdown have hard deadlines and strict synchronization requirements.

Hard systems find wide applications in areas such as air traffic and nuclear power plant control or traffic light, anti-radar, and various high-grade security systems.

### 3.1. Characteristics

Hard systems respond in a deterministic and predictable way. Usually, they follow well-defined mathematical models.

A hard system is robust. This means it works correctly in all environments. For instance, in aeronautics, airplane flight control and anti-brake systems are designed to work in all conditions and avoid fatal accidents.

Hard real-time systems have two modes. The default mode is where all tasks meet their deadlines. The other is the failure mode, where a task misses its deadline, and we get a failure.

## 4. Soft Real-Time Systems

A soft real-time system (or best-effort system) is expected to finish its execution by a short deadline, but missing it doesn’t lead to total system failure. In other words, late completion is highly undesirable but tolerated:

### 4.1. Characteristics

A soft system’s two most important characteristics are flexibility and the pre-defined tolerance level.

Soft systems are not only more flexible in comparison to hard real-time systems, but they also have a greater tolerance for a specific class of tasks that miss their deadlines.

Just like hard systems, soft systems have a default mode. Additionally, whenever a task misses its deadline, the system enters the degraded mode, where performance suffers until it goes below the tolerance threshold. Once that happens, the system enters failure mode.

### 4.2. Examples

A paradigmatic example of a soft system is a desktop operating system such as Windows 10. When we open the file explorer multiple times, the system sometimes hangs (it becomes unresponsive). In that case, we experience delay and slowness. Once the pending file explorer windows open, the system is restored to its old state.

Another example is a cellular system. Let s say we’re traveling in a bus while watching a high-definition movie on our mobile using a good 4G or 5G connection. In areas with poor network coverage, we’ll see a lag in our stream due to insufficient bandwidth. The streaming application doesn’t stop, but its performance gets degraded.

Soft systems find wide applications in multimedia communication, desktop computers, websites, online multiplayer gaming, cellular networks, online databases, and networking.

## 5. Hard vs. Soft Real-Time Systems

Let’s  summarize the differences between hard and soft systems:

```
```

We define data integrity as the accuracy, completeness, and consistency of data taken as a whole. We associate safety with data integrity. In soft systems, we ensure data integrity over longer time spans. On the other hand, hard systems have a much shorter data-integrity span because of strict deadlines.

We define the peak load as the system’s maximum load at any given time. In the case of soft systems with peak load, the performance degrades due to the availability of resources. In contrast, hard systems have a stable performance during peak load time.

## 6. Conclusion

In this article, we studied real-time systems in detail. Real-time systems respond to events predictably and within restrictive time constraints.

For this reason, we design all systems that require a higher degree of safety, control, precision, and predictability as real-time systems.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.