liveBook · Manning

Interrupt

As explained in Modern C, Third Edition

A hardware interrupt is an execution event caused synchronously by a processor-detected fault or hardware condition.

Suppose a processor detects a fault while executing an instruction, such as division by zero or an access to a nonexistent memory bank. It raises a hardware interrupt at that instruction. The event is synchronous: the faulting instruction identifies where it occurred. section 19.6

On many processors, the fault selects an entry in an interrupt vector table. That entry points to a handler, and execution switches away from the program to run it. Fault names and locations vary across platforms, so using this mechanism directly is not portable. C signal handlers provide a portable abstraction for handling both hardware and software interrupts. section 19.6

TAKEAWAY: A hardware interrupt is tied to a faulting instruction; a software interrupt is asynchronous and may arrive during an intermediate execution state. section 19.6

How Modern C, Third Edition covers it

How deep it goes
Explains fault detection, vector-table dispatch, and portability limits without detailing processor-specific handler implementation.
Examples
Uses division by zero, nonexistent memory banks, and misaligned addresses as processor-detected fault examples.
What it assumes
Assumes familiarity with program instructions while introducing synchronous and asynchronous events and interrupt-vector dispatch.
What you can do after
Evaluate/understand whether an exceptional event is tied to a faulting instruction and why direct interrupt handling is platform-dependent.
How it connects
Connects hardware interrupts to traps, synchronous signals, software interrupts, interrupt vector tables, and C signal handlers.

Also explained in

Compare how 4 books explain interrupt →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C, Third Edition. The section links point to the parts of the book it draws on.