What is an interrupt and how are multiple interrupts dealt with?
An Interrupt is a signal that goes into a microprocessor that
tells it something has happened that needs attention. There are
generally dedicated pins on the microprocessor, often called "Int"
(for Interrupt) and "NMI" (for Non-Maskable Interrupt). For a
microprocessor, an interrupt signal is like the bell on a telephone
is for you; it's a notice that you should stop what you are doing
now and deal with this issue that has come up.
Exact procedures for dealing with an interrupt vary from one
microprocessor to another; generally, the microprocessor puts out a
signal that says "Where should I go, then?" and a piece of
hardware, the Interrupt Controller, then responds with a signal
that tells it which condition has happened. The processor then
starts processing the indicated piece of code, and that piece of
code handles the condition.
The Interrupt Controller often handles setting priority for
interrupts, accepting a number of signals (often four), and setting
priorities on each. It will trigger another interrupt in the middle
of processing one if the new interrupt is a higher priority than
the one that is already being processed, or will hold on to the
lower priority one until the CPU is finished with a higher-priority
one.
The CPU can often "disable interrupts" when it is doing
something time-critical. At such times, the only interrupt that can
occur is the Non-Maskable Interrupt, which is generally reserved
for critical error conditions that have to be dealt with
immediately no matter what else is going on.