FERMATA HOLD LLCCompany information
Science & Technology
Chapter
01Event response
General technology reading

Responding to an interrupt

An interrupt lets a processor respond to an event without repeatedly checking for it. Noticing the event and completing its work are separate tasks.

1.1

The request and the response

A program can repeatedly inspect a device for changes: polling. With interrupts, hardware raises a request and the processor transfers control to a designated handler when conditions allow. Execution can then resume.

Masking and priorities can delay the response. Exact behavior depends on the processor and its configuration.

1.2

A short handoff

In a hypothetical instrument, a button requests a reading. The handler records the request, acknowledges its source and leaves the longer calculation to the main program. A brief handler helps other work proceed.

Shared data must remain consistent during this handoff. A flag can communicate that something happened, but may not preserve the number or order of several events.

Illustrative handoff; spacing does not represent time.
  1. EventRequest raised
  2. HandlerRequest recorded
  3. Main programLonger work
1.3

Read the boundary

When reading an interrupt-based design, identify the event source, the condition that raises the request and the point at which the request is cleared. Then ask where deferred work happens and what occurs if another event arrives first.

Timing, lost events and shared information still need explicit attention.

Further reading: Microchip Technology: CPU Interrupt Controller overview.