Home / Learn Embedded C / Interrupt Latency Explained

Interrupt Latency Explained

The delay between a hardware event occurring and its ISR actually starting to run.

The short versionThe delay between a hardware event occurring and its ISR actually starting to run.

Theory in plain words

In plain terms

Interrupt latency is the time between the triggering hardware event and the first instruction of its ISR actually executing — never zero, due to detection time, any higher-priority work in progress, and the CPU's own state-saving overhead.

Why we use it

Hard real-time applications (some motor control, some safety systems) need to know the worst-case interrupt latency, not just the typical case, to guarantee a response within a required time budget.

Under the hood

Latency is affected by whether interrupts are currently disabled (e.g. inside a critical section), whether a higher or equal priority ISR is already running, and the fixed overhead of the CPU's own state-save sequence before jumping to the handler.

Real-world use

  • Hard real-time response guarantees
  • Motor control timing budgets
  • Safety-critical response analysis

Try it

Computing a simulated worst-case latency from its contributing factorsC: edit and run

A hard real-time design must budget for this worst-case figure, not just the typical, usually much shorter, latency.

Tip:Keeping critical sections and higher-priority ISRs as short as possible is the main lever firmware has over worst-case interrupt latency for lower-priority events.

Try it: a critical section adding to the worst-case latency

Adding an in-progress critical section to the latency budgetC: edit and run

An interrupt that fires while a critical section is active must wait for it to finish before the CPU even begins its normal save/jump sequence, adding directly to latency.

Quick quiz

1. What does "interrupt latency" measure?