Interrupt latency is the time that elapses between the moment a hardware device asserts an interrupt signal and the moment the processor begins executing the corresponding interrupt service routine (ISR). In operating systems, it is a key measure of how quickly drivers & devices can get attention from the CPU, and it sets a lower bound on how fast the system can react to external events.
Engineers care about two numbers: the typical latency, which affects throughput and responsiveness, and the worst-case latency, which decides whether a real-time deadline can be guaranteed. A system with excellent average latency may still be unsuitable for control tasks if rare spikes exceed the allowed bound.
What happens between the interrupt signal and the handler
Interrupt latency is the sum of several sequential delays in hardware and software. A device raises an interrupt request line or sends a message signaled interrupt; the interrupt controller prioritizes it and forwards it to a CPU core; the core finishes or abandons the current instruction, saves state, consults the interrupt vector table and jumps to the entry code of the handler.
The table below breaks the path into its components. The ranges are indicative for modern hardware and vary with processor design, clock speed and system load.
| Stage | What causes the delay | Indicative range |
|---|---|---|
| Signal propagation | Bus transfer, MSI write, controller routing | Tens to hundreds of nanoseconds |
| Interrupt masking | Code running with interrupts disabled | Nanoseconds to milliseconds |
| Instruction completion | Finishing long or multi-cycle instructions | A few to hundreds of cycles |
| Context save and dispatch | Pushing registers, vector lookup, mode switch | Tens to hundreds of cycles |
| Cache and TLB misses | Handler code and data not in cache | Hundreds of nanoseconds or more |
| Power state exit | Waking a core from a deep idle state | Microseconds to over 100 µs |
In practice, the longest interrupt-disabled section in the kernel and the deepest allowed idle state dominate the worst case. Hardware dispatch on a microcontroller can take as little as 12 cycles, while a general-purpose desktop may show worst cases of tens or hundreds of microseconds.
Interrupt latency versus related timing measures
Interrupt latency is often confused with neighboring measurements. Precise vocabulary matters because a vendor figure for one of them does not predict the others.
| Measure | Starts at | Ends at |
|---|---|---|
| Interrupt latency | Device asserts the interrupt | First instruction of the ISR |
| Interrupt response time | Device asserts the interrupt | ISR performs useful work |
| Deferred processing latency | ISR finishes | Bottom half, DPC or threaded handler runs |
| Scheduling latency | Task becomes runnable | Task actually runs on a CPU |
| End-to-end I/O latency | Application issues a request | Application receives the result |
Modern kernels split interrupt handling into a short top half that acknowledges the device and a deferred part, such as Linux softirqs and threaded IRQs or Windows deferred procedure calls. This design keeps interrupt latency low for other devices, but it moves work into a later phase whose delay must be measured separately.
Factors that increase interrupt latency
Latency grows whenever something prevents the CPU from accepting the interrupt or slows the path to the handler. Many of these causes are invisible in normal benchmarks and appear only under specific load.
- Long critical sections in drivers or the kernel that disable interrupts or hold spinlocks with interrupts off.
- Poorly written ISRs of other devices that run for a long time at higher priority.
- Deep CPU idle states (C-states) and frequency scaling, which add wake-up time.
- System management interrupts (SMIs) on x86, which run firmware code invisible to the operating system.
- Virtualization, where the hypervisor must intercept and inject interrupts into a guest.
- Interrupt coalescing in network cards, which deliberately delays interrupts to batch work.
Measuring and reducing interrupt latency
Interrupt latency is measured by timestamping a known external event and the start of its handler. Common approaches include toggling a GPIO pin in the ISR and observing it with an oscilloscope, using tracing tools such as ftrace or Event Tracing for Windows, or running test programs like cyclictest that report maximum observed latency over long periods.
The next table pairs common goals with techniques that experienced engineers apply. Each technique has a cost, usually in power consumption or throughput, so the choice depends on the workload.
| Goal | Technique | Trade-off |
|---|---|---|
| Bound the worst case | PREEMPT_RT kernel or a real-time OS | Slightly lower average throughput |
| Avoid wake-up delay | Limit deep C-states on critical cores | Higher idle power and heat |
| Reduce interference | Pin the interrupt and task to an isolated core | Fewer cores for general work |
| Shorten handlers | Move work to threaded or deferred handlers | More complex driver design |
| Speed up delivery | Use MSI or MSI-X instead of shared lines | Requires device and platform support |
| Remove batching delay | Disable or tune interrupt coalescing | More interrupts and CPU load |
Where interrupts arrive too often, the opposite approach can win: polling or hybrid schemes such as Linux NAPI disable interrupts during bursts and process many events per pass. This trades a little latency at low load for far better throughput at high load.
Why worst-case latency matters more than the average
For real-time systems, a single late interrupt can be a failure. A motor controller sampling at 20 kHz has a period of 50 µs; if one interrupt arrives 80 µs late, a control cycle is lost no matter how good the average is. Certification of safety-related systems therefore relies on measured and analyzed worst-case bounds, not on mean values.
General-purpose desktops usually do not guarantee bounds at all. Audio dropouts, input stutter and missed frames on such systems often trace back to a single misbehaving driver that disables interrupts or runs a long deferred routine.
The short version
Interrupt latency is how long a device waits before the computer starts paying attention to it. When a key is pressed or a network packet arrives, the hardware taps the processor on the shoulder, and the latency is the pause before the processor turns around.
Most of the time the pause is tiny. What matters for machines and audio is the longest pause, because one slow response can cause a glitch even if all the others were quick.
Where it makes a difference
A small manufacturer builds an industrial robot arm controlled by a Linux computer. The motor encoder raises an interrupt every 100 µs, and the control loop must react within 30 µs. On a standard kernel, a week-long cyclictest run shows worst-case latency spikes near 400 µs, caused mainly by deep idle states and a storage driver that disables interrupts during long transfers.
The engineers switch to a PREEMPT_RT kernel, isolate one core for the encoder interrupt and the control task, and limit that core to shallow idle states. A new test over seven days shows a maximum latency of about 18 µs. The arm now meets its timing budget with margin, at the cost of slightly higher idle power.