What are the types of Program Interrupts in Computer Architecture?

Program interrupt defines the transfer of program control from a currently running program to another service program as a result of an external or internal created request. Control returns to the initial program after the service program is implemented.

There are three major types of program interrupts that are as follows −

External Interrupts

External interrupts come from input-output (l/0) devices, from a timing device, from a circuit monitoring the power supply, or from any other external source. The timeout interrupt can result from a program that is in an endless loop and thus exceeded its time allocation. Power failure interrupt can have as its service routine a program that transfers the complete state of the CPU into a non-destructive memory in a few milliseconds before power ceases.

Internal Interrupts

Internal interrupts arise from illegal or erroneous use of an instruction or data. Internal interrupts are also called traps. These error conditions generally appear as a result of premature termination of the instruction execution. The service program that processes the internal interrupt determines the corrective measure to be taken.

The main difference between internal and external interrupts is that the internal interrupt is initiated by some exceptional condition caused by the program itself rather than by an external event. Internal interrupts are synchronous with the program while external interrupts are asynchronous. If the program is rerun, the internal interrupts will appear in the same place each time. External interrupts depend on external conditions that are independent of the program being executed at the time.

Software Interrupts

A software interrupt is initiated by executing an instruction. A software interrupt is a special call instruction that behaves like an interrupt rather than a subroutine call. It can be used by the programmer to initiate an interrupt procedure at any desired point in the program.