Hard vs Soft vs Firm Real-Time Requirements Explained
Hard, firm and soft real-time differ in what a missed deadline costs, not in how short it is. Learn to classify requirements with examples and a utility test.

"We need a real-time system" is not a requirement. It is the start of one. The useful question is what happens when a deadline is missed, because the answer decides how much analysis, testing and margin the design needs. This post defines hard, firm and soft real-time, shows how to classify a requirement from its consequence, and gives code that treats each class differently. It builds on the earlier post on what makes an operating system real-time, which defined latency and deadline.
Classify by consequence, not by speed
The three names describe the value of a late result.
| Class | Value of a late result | Effect of one miss | Example |
|---|---|---|---|
| Hard | Negative: it causes harm | System failure | Airbag deployment, motor commutation, pacemaker pulse |
| Firm | Zero: it is discarded | Degraded output, system survives | Video frame decode, audio buffer refill, sensor sample for a control loop that tolerates gaps |
| Soft | Positive but decaying | Lower quality of service | Touchscreen response, logging, network keep-alive |
Notice that nothing here mentions duration. A 2 second deadline on a pressure relief valve is hard. A 5 millisecond deadline on a status LED animation is soft. The class comes from the consequence.
A quick test: draw the utility of the result against time. For a hard deadline the curve drops below zero at the deadline. For a firm one it drops to exactly zero. For a soft one it falls gradually and stays positive for a while.
Hard real-time: prove it, then test it
For a hard requirement, "it worked in testing" is not evidence. You need an upper bound on the worst case, which means worst-case execution time for each task, a known interrupt load and a schedulability argument. Rate-monotonic analysis is the classic tool, and it needs numbers you can defend, not averages.
In code, the hard path gets the highest priority, does bounded work and avoids anything unbounded. Here is a motor commutation task in FreeRTOS Kernel V11.3.3 that blocks on a notification given by the timer interrupt:
#include "FreeRTOS.h"
#include "task.h"
#define PRIO_COMMUTATION (configMAX_PRIORITIES - 1)
static TaskHandle_t xCommutationTask;
void TIM1_UP_IRQHandler(void)
{
BaseType_t xWoken = pdFALSE;
TIM1->SR = 0;
vTaskNotifyGiveFromISR(xCommutationTask, &xWoken);
portYIELD_FROM_ISR(xWoken);
}
static void vCommutationTask(void *pvParameters)
{
(void) pvParameters;
for (;;)
{
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
write_phase_outputs(next_phase());
}
}
void commutation_start(void)
{
xTaskCreate(vCommutationTask, "comm", 192, NULL, PRIO_COMMUTATION, &xCommutationTask);
}The task does two bounded calls and sleeps. No heap allocation, no printing, no waiting on a lock another task may hold. Note that the interrupt priority of TIM1_UP_IRQHandler must be at or below the kernel's maximum syscall priority for this to be legal, which is covered in the post on vPortValidateInterruptPriority assertions.
Firm real-time: drop late work on purpose
A firm requirement lets you throw the late result away, and the code should do that explicitly instead of processing stale data. A common pattern is a deadline stamp checked on arrival:
#include "FreeRTOS.h"
#include "task.h"
typedef struct {
TickType_t xDeadline;
uint8_t pucPixels[64];
} frame_t;
static unsigned s_dropped;
void show_frame(const frame_t *pxFrame)
{
if ((int32_t) (xTaskGetTickCount() - pxFrame->xDeadline) > 0)
{
s_dropped++;
return;
}
display_write(pxFrame->pucPixels, sizeof pxFrame->pucPixels);
}The signed subtraction handles tick-counter wraparound, the same technique the kernel uses internally. A late frame is counted and skipped, so the next frame has the whole budget.
frames shown: 598, dropped: 2That output is illustrative; the actual counts depend on load. What matters is that the drop counter exists, because a firm system whose drop rate you cannot read is a system you cannot tune.
Soft real-time: measure and tolerate
Soft requirements are quality targets, usually stated as a percentile: "95 percent of button presses produce visible feedback within 100 ms." You measure, you watch the tail, and you accept occasional misses. The design needs less rigor, but it still needs a priority scheme so soft work does not starve hard work.
A practical arrangement puts soft tasks at low priorities and gives them timeouts instead of indefinite waits, so a stuck peripheral shows up as a logged timeout instead of a frozen feature.
if (xQueueReceive(xNetQueue, &msg, pdMS_TO_TICKS(250)) == pdPASS)
{
send_to_cloud(&msg);
}
else
{
log_warn("net queue idle for 250 ms");
}Writing the requirement down
A requirement that survives review names four things: the event that starts the clock, the response that stops it, the time allowed and the consequence of exceeding it. "The valve closes within 50 ms of the pressure sensor crossing the trip threshold; a late close can rupture the line" is a hard requirement you can design and test against. "The system shall respond in real time" is not a requirement at all, and it will be read as hard by the people who fear audits and as soft by the people who fear schedules.
Writing the consequence beside the number also settles arguments later. When a developer asks whether the log flush can run inside the control task, the requirement answers: the control task is hard, the flush is soft, so the flush belongs elsewhere. When a manager asks whether a 2 percent drop rate on video frames is a defect, the requirement answers: the stream is firm, and the acceptance criterion is a drop rate, not zero.
Percentages need a window. "Fewer than 1 percent of frames dropped" means little unless the requirement says over how long and under what load. State both, so the test that checks it has the same definition as the requirement that created it.
Mixed systems are the norm
Real products contain all three classes at once. A drone flight controller has a hard attitude loop, a firm telemetry stream and a soft logging task. The design rule is to keep the hard path small, separate and protected: highest priority, no shared locks with lower classes, and nothing in it that can block for an unbounded time. Everything else can be looser.
This is also where an RTOS earns its place. Priorities let you express "this matters more" without hand-tuning a loop, and the kernel enforces it at every scheduling point.
Common mistakes
Calling everything hard is the most expensive one. It sends the team into worst-case analysis for work that tolerates misses, and the resulting margins waste CPU. Calling everything soft is the dangerous one, usually justified by "we have never seen it fail." Absence of observed failure is not a bound.
A subtler mistake is classifying the function instead of the event. The same sensor read can be hard when it feeds a safety interlock and soft when it feeds a dashboard. Classify each deadline in the requirements document, with its consequence written beside it.
The boundary of this post: classification is the first step, and it does not give you a schedulability proof. For regulated products, the standards you certify against (IEC 61508, ISO 26262, DO-178C) define their own vocabulary and evidence rules, and those rules win over any informal label.


