Interrupts are an alternative to polling. Once an external device has new data, it triggers an event in a processor called an interrupt. As its name suggests, it interrupts the normal workflow of executing instructions. The processor saves its current state and starts executing instructions from a different address until it encounters the return from an interrupt instruction. Then, it reads the saved state to continue executing the instruction stream from the moment it was interrupted. This alternative sequence of instructions is called an Interrupt Service Routine (ISR).
Each processor defines its own set of instructions and conventions to work with interrupts; however, all of them use the same general approach while dealing with interrupts:
- Interrupts are identified by numbers, starting with 0. The numbers are mapped to the hardware interrupt...