Frequently Asked Question
What is an interrupt and how does the kernel handle one?
An interrupt is a hardware signal that asks the CPU to drop what it's doing and run a specific kernel function, the interrupt handler. The keyboard fires an interrupt when you press a key; the network card fires one when a packet arrives; the timer chip fires hundreds per second so the scheduler can preempt long-running tasks.
The handler runs in interrupt context: it can't sleep, can't take most locks,
and should finish as fast as possible. Linux splits the work into two halves: the
top half (hard IRQ) does the minimum needed to acknowledge the device, and the
bottom half (softirqs, tasklets, workqueues, or threaded IRQs) runs the
expensive part later in a more relaxed context. cat /proc/interrupts shows
which CPU is handling each line.