Real-Time Systems and RTOS

Hard vs Soft Real-Time Systems and Timing Constraints

Hard, firm, and soft real-time explained: what a missed deadline costs, the timing constraints embedded systems face, and how each class shapes your design.

On this page
  1. Hard vs soft real-time at a glance
  2. What counts as a timing constraint?
  3. Hard real-time
  4. Firm real-time
  5. Soft real-time
  6. Hard vs firm vs soft compared
  7. Thinking in terms of the value of a late result
  8. One product, several kinds of deadline
  9. Common misconceptions
  10. How the classification changes your design
  11. Timing among other embedded constraints
  12. Frequently asked questions

Hard vs soft real-time at a glance

The difference comes down to what happens when a deadline is missed:

  • In a hard real-time requirement, a missed deadline counts as a failure. The late result is useless or dangerous, and the system has to be designed so that misses don’t happen under any condition it’s specified for.
  • In a soft real-time requirement, a missed deadline degrades quality but the late result still has some value. The goal is to meet deadlines almost all the time and to recover gracefully when you don’t.
  • Many engineers add a middle category, firm real-time. An occasional miss is tolerable, but a late result has no value and gets thrown away.

All three are “real-time” because correctness depends on when things happen, not just what is computed. If you’re new to the broader idea, start with our overview of real-time embedded systems.

What counts as a timing constraint?

“Deadline” is the word everyone uses, but embedded requirements come in several shapes. Writing down which kind you have is the first step toward checking it.

Types of timing constraint

  • Relative deadline: the maximum time allowed from an event to the completed response. For example, “update the PWM duty cycle within 50 µs of the ADC conversion finishing.”
  • Absolute deadline: a fixed point in time by which work must be done, such as “before the next frame starts.”
  • Period: how often periodic work repeats, like a control loop that runs every 1 ms.
  • Release time (or phase): the earliest time work may start. Some outputs must not happen too early, such as firing an injector or sampling at a set point in a cycle.
  • Minimum inter-arrival time: for events that don’t arrive on a fixed schedule, the shortest gap that can occur between two of them. Without it you can’t bound the load.
  • Latency bound: a limit on the delay between an input and the system’s first reaction, such as interrupt latency.
  • Jitter bound: a limit on how much timing varies from one cycle to the next. A control loop can meet every deadline and still perform badly if its sampling instant wanders.
  • End-to-end constraint: a limit that spans several steps, possibly on several processors. “Sensor to actuator in under 5 ms” includes sampling, communication, computation, and output.

Periodic, sporadic, and aperiodic events

Real-time analysis also depends on how work arrives:

  • Periodic work arrives at regular intervals: timer-driven control loops, sampling, and display refresh.
  • Sporadic work arrives irregularly, but with a known minimum gap between arrivals: a button press after debouncing, or a message on a bus with a bounded rate.
  • Aperiodic work arrives irregularly with no guaranteed minimum gap, such as user commands or network traffic. You generally can’t give it hard guarantees without limiting it somehow, for example with a rate limiter or a budget.

Hard real-time

A hard real-time requirement treats every miss as a failure. Typical examples given in textbooks and industry material include airbag deployment, anti-lock braking, and many flight-control functions. In each case a correct answer delivered late doesn’t help, and could cause harm.

Hard requirements have a few consequences:

  • You design for the worst case, not the average. That means bounding the worst-case execution time (WCET) of the code, the worst-case interrupt load, and the worst-case blocking.
  • Testing alone is rarely considered enough. Teams add analysis, such as schedulability tests and timing measurements under maximum stress, and sometimes static WCET tools.
  • The software architecture leans toward predictability: static memory allocation, bounded loops, fixed priorities, and simple, well-understood scheduling.

Hard real-time does not mean extremely fast. A requirement to close a valve within two seconds of a pressure alarm, every single time, is a hard requirement with a generous deadline.

Firm real-time

In a firm real-time requirement, a late result is worthless, so it’s discarded, but an occasional miss doesn’t count as system failure. Examples include:

  • A measurement sample that arrives after the processing window closes. It’s dropped, and the system carries on with the next one.
  • A frame in a communication protocol that misses its slot and is simply lost.
  • A vision-inspection station on a production line that can’t finish analyzing one item in time, so it rejects that item for manual checking.

Firm requirements often come with a statistical limit, such as “no more than one missed frame in any 100” or “no two misses in a row.” That turns a vague expectation into something you can test.

Soft real-time

In a soft real-time requirement, lateness reduces quality but the result still has some value. Audio and video playback, user interface responsiveness, and logging are common examples. A display update that arrives 20 ms late is a little less pleasant, not a failure.

Soft doesn’t mean unimportant. Users notice stuttering audio and laggy controls, and products get returned for it. The difference is in how you specify and verify it. Soft requirements are often written as percentiles (“95% of button presses acknowledged within 50 ms”) rather than absolute guarantees.

Hard vs firm vs soft compared

Hard Firm Soft
Consequence of a miss Failure; possibly damage or harm Lost result; degraded service Lower quality
Value of a late result None, or harmful None (discarded) Reduced but still positive
Design target Never miss under specified conditions Bound how often misses happen Meet deadlines most of the time
How it’s usually specified Absolute deadline Deadline plus allowed miss rate Average or percentile response
Typical verification Worst-case analysis plus stress testing Stress testing, statistical limits Load testing, measured percentiles
Common examples Brake and airbag control, motor current loops Sampled measurements, some protocol frames Audio/video playback, UI, logging

Thinking in terms of the value of a late result

A useful mental model is to picture the value of a result as a function of when it’s delivered:

  • For a hard requirement, value stays full up to the deadline, then drops off a cliff, possibly below zero, meaning harm.
  • For a firm requirement, value drops to zero at the deadline. Late results are simply worthless.
  • For a soft requirement, value decreases gradually after the deadline. Slightly late is nearly as good as on time; very late is not.

This view helps when requirements are vague. Ask: “If this result were 10% late, what would happen? What about twice as late?” The answers tell you which class you’re dealing with.

One product, several kinds of deadline

“Hard” and “soft” describe individual requirements, not whole devices. Consider an industrial motor drive:

  • The current control loop must update the PWM outputs every cycle. A miss can cause overcurrent or a trip, so this is hard.
  • The fieldbus messages from the controlling PLC must be handled within their cycle. A late command is ignored and the previous value is reused, which is firm.
  • The front-panel display and event logging are soft. Nobody is harmed if the display lags.

Good designs keep these separate. The hard work usually goes in high-priority interrupts or tasks with tightly bounded code, while soft work runs at lower priority where it can’t delay the critical path. That separation is a main reason teams use priority-based scheduling. See real-time scheduling and multitasking in embedded systems for how priorities are assigned and checked.

Common misconceptions

  • “Hard real-time means fast.” Speed and predictability are different things. Hard real-time is about guaranteed bounds, which can be microseconds or seconds.
  • “Soft real-time means you can ignore timing.” Soft requirements still need to be specified and tested. They just tolerate occasional misses.
  • “Using an RTOS makes a system hard real-time.” An RTOS gives you tools, like priorities and bounded kernel operations, but your code, interrupt load, and resource sharing determine whether deadlines are met. Many hard real-time systems use no RTOS at all. See RTOS vs super loop.
  • “Safety-critical and hard real-time are the same thing.” They overlap a lot, but they are separate ideas. A hard deadline in a test instrument might only cost a ruined measurement, while a safety function might have a fairly relaxed deadline.
  • “Everyone agrees how to classify common examples.” They don’t. You’ll find a pacemaker listed as hard real-time in one source and soft in another. Classification depends on the specific function and its consequences, so it’s better to analyze your own requirement than to copy a label.

How the classification changes your design

Once you’ve classified each requirement, a few design decisions follow:

  • Analysis effort. Hard requirements justify worst-case analysis: measuring WCET, accounting for interrupts and blocking, and running schedulability tests. Soft requirements are often handled with load testing and measured percentiles.
  • Margins. Hard paths are usually designed with CPU headroom so that small changes in code or compiler output don’t push them over the edge.
  • Resource sharing. Shared buses, mutexes, and queues on a hard path add blocking time. Bound it, and use priority inheritance where locks are unavoidable. See RTOS task synchronization and inter-task communication.
  • Memory. Hard paths typically avoid dynamic allocation after startup and size stacks deliberately. Our guide on how to size RTOS task stacks covers that in detail.
  • Failure handling. Watchdogs, safe states, and degraded modes matter more as the cost of a miss rises. For firm and soft requirements, decide in advance what happens to late data: drop it, reuse the last value, or catch up.
  • Standards. Safety-related products are often developed under domain standards such as IEC 61508 (general functional safety), ISO 26262 (road vehicles), DO-178C (airborne software), or IEC 62304 (medical device software). These affect how timing must be demonstrated and documented.

Timing among other embedded constraints

Timing is rarely the only constraint. Embedded systems are also limited by cost, power, memory, size, heat, and electrical noise, and these interact with timing:

  • A cheaper microcontroller has less CPU headroom for the worst case.
  • Low-power sleep modes add wake-up latency that has to fit inside your deadlines.
  • Small RAM limits how many tasks, buffers, and queues you can afford.
  • Electrical noise and faults can trigger extra interrupts that add load at the worst possible moment.

Treat timing as one requirement among many and check it alongside the others, rather than optimizing for it in isolation.

Frequently asked questions

Is every hard real-time system safety-critical?

No. Hard means a miss counts as failure, but the failure might be a scrapped part or a corrupted measurement rather than a safety hazard. Many safety-critical functions do have hard timing requirements, which is why the terms are often linked.

Can Linux be used for hard real-time?

Linux with the PREEMPT_RT capabilities can achieve low and fairly consistent latency, and it’s used in many industrial and robotics systems. It’s generally harder to analyze for worst-case behavior than a small RTOS or bare-metal code, so very strict or certified hard real-time functions are often placed on a separate microcontroller or core.

What is an example of soft real-time in an embedded system?

Audio playback in a Bluetooth speaker is a common one. If a buffer is refilled late, you hear a click or dropout, which is annoying but not dangerous, and playback continues.

What are the four types of embedded systems?

A common textbook classification by function is standalone (works on its own, like a microwave controller), real-time (must meet timing constraints), networked (connected to other systems, like a smart meter), and mobile (portable and battery-powered, like a fitness tracker). The categories overlap; a fitness tracker is mobile and networked and has soft real-time functions. For examples across industries, see real-time system applications and examples.

The complete guide to real-time systems and rtos

Real-Time Embedded Systems Explained
Read the guide

Keep exploring

Guides from other topics

All topics →