Interrupts
An interrupt is a signal sent to the CPU that interrupts the current procces. An interrupt can occure for different reasons, it could be generated by a software or hardware issue.
The fetch-execute cycle is always in use. If an error occurs in the system then an interrupt is sent to the processor to grab its attention, the current instruction being decoded/executed is put onto the stack and the Program Counter then starts the interrupt cycle. Here are a few exmaples of some interrupts that may occur:
- A printer sends a request for more data to be sent to it.
- The user presses a key or clicks a mouse button.
- An error occurs during the execution of a program, for example, if the program tries to divide by zero or tries to access a file that does not exist.
- An item of hardware develops a fault.
- The user sends a signal to the computer asking for a program to be terminated.
- The power supply detects that the power is about to go off.
- The operating system wants to pass control to another user in a multitasking environment.