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.
When a computer start running, i.e., when it is powered up or rebooted. it needs to have an initial program to run.
This initial program, or bootstrap program, tends to be simple. Typically, it is stored in read-only memory (ROM) or eletrically erasable programmable read-only memory (EEPROM), known by the general term firmware, within the computer hardware.