Interrupts are Signals which need immediate attention and perform operation generally stored in Interrupt Service Routine (ISR), ISR contains instruction which CPU should perform on occurrence of Interrupt , these instructions are located in some part of memory. Interrupts may be due to Hardware or Software , Example of a software interrupt is divide by Zero , Hardware interrupts may be due to internal or External devices.
CPU should stop its present operation, perform instructions contained in ISR, and after completing , it should resume the operations, it was performing prior to executing ISR.
The detailed operation may differ from one system to another but the concepts may be summarized as follows
- Normally after execution of each Instruction CPU checks whether there is any interrupt.
- Next step is what to do after interrupt is detected. To answer this part we take example of typical. 8086 processor
- To find ,where are ISR instructions located : In a typical 8086 processor has a vector table. it contains interrupt numbers and address of ISR corresponding to Interrupt numbers
- CPU needs to know the interrupt number . For external interrupts , the instruction no's for external hardware ,are generally conveyed by external Interrupt controllers and writing the code of Interrupt service Routine for these interrupts is also is job of Programmer/Designer.
- For certain software interrupts the interrupt numbers are fixed.
- On getting the interrupt number CPU gets the address of. ISR from vector table and prepare itself for handling the interrupt
- Before an Interrupt is going to be executed the address of the instruction of running program, which CPU should perform after executing ISR should be stored somewhere , as also the status of flags , the processor Id or any other information required for coming back to present program.
- After executing ISR, CPU based on above information resume its operation
These are some of the basic Operation which are required ,