Skip to content

Real-time

This section will explain what is hard vs soft real time. Where they are often used and what are the key things you need to know before developing your application.

Hard Real-Time Systems

Definition: Hard real-time systems are those in which it is absolutely critical that responses to inputs or events are produced within a specified deadline. Missing a deadline is considered a system failure and can have severe consequences, including the potential for loss of life, significant financial loss, or failure of the mission the system was designed to accomplish.

Characteristics

Absolute Deadline Adherence: Failure to meet deadlines is unacceptable and considered a system failure.

Determinism: The behavior and response times of the system are predictable and can be precisely determined ahead of time.

Often Embedded and Isolated: Many hard real-time systems are embedded within larger systems and operate in isolation from non-real-time processes to ensure timeliness and predictability.

Use Cases

Chemical Plant Control Systems: In chemical plants, process control systems regulate reactions, pressure, temperature, and flow rates within very tight tolerances. These systems must operate in hard real-time to prevent dangerous conditions, such as overheating or excessive pressure buildup, which could lead to explosions or toxic releases.

Autonomous Vehicles: Robots used in autonomous vehicles (including drones, unmanned ground vehicles in logistics, or exploration rovers) operate under hard real-time constraints to process sensor data and make immediate decisions for navigation and obstacle avoidance. Delays in processing and response could lead to collisions or mission failure.

Industrial Robots: Used in manufacturing, assembly, and packaging, industrial robots need to operate with precise timing and coordination, especially when integrated into a production line with other robots and human workers. Hard real-time control ensures that movements are synchronized, preventing collisions and ensuring safety and efficiency in high-speed manufacturing processes.

CNC (Computer Numerical Control) Machines: CNC machines are used for precisely cutting, drilling, and shaping materials. They operate under hard real-time constraints to ensure movements are precisely timed and executed according to the programmed instructions. Any delay or timing error can lead to incorrect cuts, potentially ruining materials and causing safety hazards.

INFO

Hard real-time systems run in continuous control loops. Typical control loop times are between 100μS to 5ms.

WARNING

When a program configured for hard real time exceeds it's set cycle time it will immediately go into an error and stop.

Soft Real-Time Systems

Definition: Soft real-time systems are those in which performance is critical but not absolutely mandatory. That is, these systems aim to meet their deadlines as often as possible, but not meeting a deadline is not catastrophic. The usefulness of a result decreases after its deadline, yet it doesn't render the result useless immediately.

Characteristics

Flexibility in Deadline Achievement: Meeting deadlines is preferred but occasionally missing them doesn’t cause failure of the entire system.

Quality of Service Degradation: Performance may degrade if deadlines are missed, but the system continues to function.

Typically Easier to Design: Less stringent than hard real-time systems, allowing for a bit more flexibility in design and implementation.

Use Cases

Data Processing: Batch processing jobs where processing time is important, but delays are not critical.

Websites: Responsive websites that aim for quick responses to user inputs but can tolerate occasional delays.

Smart Home and IoT Devices: Devices in smart homes, such as thermostats, lighting controls, and security cameras, operate under soft real-time constraints. They aim to respond promptly to sensor inputs and user commands, but slight delays are generally acceptable.

WARNING

Virtual machines can only run in soft real-time. Hard-real time is not possible due to the CPU virtualization. The program must be run on the host operating system to be able to run in hard-real time.

Commonalities and Differences

Commonalities

Both aim to meet time constraints in processing and responding to inputs or events.

Both are crucial in domains where the timing of computations affects functionality and outcomes.

Differences

The tolerance for missing deadlines distinguishes soft from hard real-time systems. Hard real-time systems have zero tolerance for missed deadlines, while soft real-time systems allow for some flexibility. The consequences of missing deadlines are much more severe in hard real-time systems, potentially leading to catastrophic outcomes.

Design and testing rigor: Hard real-time systems require much more rigorous design, testing, and validation processes to ensure deadlines are always met, compared to the more flexible requirements of soft real-time systems.

TIP

Understanding these differences is crucial to dictate the correct approach, technology, and methodology used in the development of real-time systems, ensuring that the right balance between responsiveness, reliability, and resource utilization is achieved for the intended application.