Interrupt Request (IRQ): A device or software sends a signal to the interrupt controller, which then alerts the CPU that an event requires attention.
Finish Current Cycle: The CPU does not stop instantly; it completes the current Fetch-Execute cycle for the instruction it is currently processing to ensure data integrity.
Save State: The current contents of the processor registers, including the Program Counter (PC) and Status Register (SR), are pushed onto a system stack. This allows the CPU to remember exactly where it was and what it was doing.
ISR Lookup & Execution: The CPU identifies the type of interrupt and looks up the address of the corresponding Interrupt Service Routine (ISR) in an interrupt vector table. It then loads this address into the PC and executes the routine.
Restore & Resume: Once the ISR is complete, the saved register values are popped from the stack back into the CPU. The processor then resumes the original task from the exact point it was interrupted.
Interrupt Prioritization is the mechanism used to decide which interrupt to handle first when multiple requests occur simultaneously. Critical events, like power failure warnings, are assigned higher priority than routine events like mouse movements.
Nesting occurs when a higher-priority interrupt arrives while the CPU is already executing an ISR for a lower-priority interrupt. In this case, the current ISR is suspended, its state is saved to the stack, and the higher-priority ISR is executed immediately.
Proper management of nested interrupts prevents system conflicts and ensures that the most time-sensitive tasks are always processed with the lowest possible latency.
The 'Finish Cycle' Rule: Always remember that the CPU completes the current instruction before handling an interrupt. Examiners often test whether you know that interrupts are checked at the end of the Fetch-Execute cycle.
State Preservation: Be prepared to explain why the stack is used. Without saving the registers, the CPU would lose the context of the original program, leading to a system crash upon return.
Comparison Table: Use the following table to distinguish between key concepts during revision:
| Concept | Source | Timing |
|---|---|---|
| Hardware Interrupt | External Peripherals | Asynchronous |
| Software Interrupt | Running Applications | Synchronous/Requested |
| Trap/Exception | CPU Internal Errors | Synchronous/Error-based |