If the processor is interrupted a single time and is able to service that interrupt before something else happens, then the following four steps are predictable:
- Trigger: something causes the interrupt to occur, depends strongly on what the interrupt is for.
- Setup: the processor must get ready to handle the interrupt. This has overhead – it takes time to get the setup done. The key thing is to stop the execution of whatever is currently running and save any important information before continuing
- Execution: interrupts run like normal functions once the setup is done
- Return: returning from an interrupt is more complicated than returning from a regular function, since we have to restore any information that we previously saved. In addition, it is possible that the interrupt doesn’t return, either because we want to switch to a new task or because there is a fault