An interrupt is a signal that causes the computer to alter its normal flow of instruction execution.
eg. divide by zero, time out, I/O operation
The interrupt automatically transfers control to an interrupt processing routine which takes some action in response to the condition that caused the interrupt, and then control is returned to the program at which its execution was interrupted.
Some interrupt types:
– I/O interrupt: Generated by an I/O channel or device.
– Program interrupt: Generated by some condition that occurs during program execution (eg. divide by zero, illegal machine instruction, etc.)
– Timer interrupt: Generated by an internal timer within the CPU
Â
– Supervisor call interrupt (SVC): A SVC instruction generates an interrupt that transfers control to an OS service routine. The CPU switches from user mode to supervisor mode.
When an interrupt occurs, the status of the CPU is saved (registers, program counter etc.) and the interrupt service routine is executed. After the interrupt is processed, they are restored by the interrupt routine and control is transferred to the program. Saving and restoring the processor status is called context switching.
Interrupt priority: During the processing of an interrupt, all interrupts of equal or lower priority are inhibited, higher priority interrupts are allowed. At the end of an interrupt, if there are more than one interrupt pending, one with the highest priority is executed.
Â
Interrupt masking, is used to prevent certain interrupts from occurring while the first one is being processed.
8 Comments