The occurrence of an event is usually signaled by an interrupt from either the hardware or the software.
- Hardware may trigger an interrupt at any time by sending signal to the CPU, usually by way of the system bus.
- Software (called Trap)
- Software may trigger an interrupt by executing a special operation called a system call.
- The Trap could be, e.g., division by zero, or invalid memory access
- Before the interrupt
- Before enter the interrupt, the return address will be stored on the system stack.
- After the interrupt
- After the interrupt is serviced, the saved return address is loaded into the program counter, and the interrupted computation resumes s through the interrupt had not occurred.