What is Interrupt Mechanism In operating System:
Interrupt is a mechanism by which computer components, like memory or input or output modules, may interrupt the normal processing of the processor and request the processor to perform other specific action.
According to the store where they are generated, interrupt may be categorized into four classes
1) Program- Generated by some conditions that occur as a result of an instruction execution, such as-
- arithmetic overflow,
- division by zero,
- page fault,
- invalid instructions,
- outside memory space reference.
2) Timer - generated by a timer within the processor. This allow operating system to perform certain functions on a regular basis.
3) external input output- By an input output controller, input output devices tells the CPU request has completed by sending an interrupt signal to the processor.
4) hardware failure- generated by a failure, such as power failure or memory parity error.
Interrupt Mechanism -
Interrupt And Instruction Cycle
For the user program, an interrupt suspends the normal sequence of execution. When the interrupt processing is completed, execution resumes. Thus the user program does not have to contain any special code to accommodate interrupts.
To accommodate interrupts, an interrupt stage is added to the instruction cycle. In the interrupt stage, the processor check to see if any interrupt have occurred, indicating by the presence of an interrupt signal. If no interrupts are pending, the processor proceed to the fetch stage and fetches the next instruction of the current program.
If an interrupt is pending, the processor suspends execution of the current program and execute an interrupt handler routine.
This routine determine the nature of interrupt and perform what actions are needed.