Interrupt Cycle:
In interrupt cycle, an interrupt can occur any time during the program
execution. Whenever it is caused, a series of events of events take place so
that the instruction fetch execute cycle can again resume after the OS calls
the routine to handle the interrupt. This cycle of fetching a new instruction,
decoding it and finally executing it continues until the computer is turned
off.
Instruction cycle with interrupts |
To accommodate interrupts, an interrupt cycle is
added to the instruction cycle as shown in figure. In the interrupt cycle, the
processor checks to see if any interrupts have occurred, indicated by the
presence of an interrupt signal. If no interrupts are pending, the processor
proceeds to the fetch cycle and fetches the next instruction of the current
program. If an interrupt is pending, the processor does the following:
(i) It suspends execution of the current program
being executed and saves its context. This means saving the address of the next
instruction to be executed and any other data relevant to the processor's
current activity.
(ii) It sets the program counter to the starting
address of an interrupt handler routine. The processor now proceeds to the
fetch cycle and fetches the first instruction in the interrupt handler program,
which will service the interrupt. The interrupt handler program is generally
part of the operating system. Typically, this program determines the nature of
the interrupt and performs whatever actions are needed.
No comments:
Post a Comment