Interrupts

An interrupt is a signal sent to the CPU by software or hardware. Software might send an interrupt if it needed to use system resources such as opening a file in a word processor. If you type on a keyboard or use a mouse it will generate a hardware interrupt. A printer running out of paper or a projectors bulb failing may also result in hardware interrupts.

Handling interrupts

The idea of interrupts is part of Von Neumann's original concept. After each fetch-decode-execute cycle the processor can check for any interrupts. If there are interrupts the execution of the current program is paused so they can be handled.

When an interrupt is present the values of the program counter and the registers are pushed onto the system stack. The appropriate interrupt service routine is called and executed. Once the interrupt service routine finishes the values are popped off the system stack and returned to the appropriate registers and the fetch decode execute cycle can resume.

When a processor receives multiple interrupts at the same time it needs to prioritise the order in which they are executed. A processor has a pre-defined set of interrupt priorities, but these can be affected by code. All interrupts are then handled in order of priority before returning to the main program.

Knowledge check


Questions:
Correct:

Question text


© All materials created by and copyright S.Goff