Interrupt is a mechanism by which a program's flow of control can be altered.
When an interrupt occurs, the CPU suspends its execution of the current
program, and transfers control to an Interrupt Service Routine (ISR), also called a Handler, that will
provide the requested service by the interrupt. When the ISR is completed,
the original program resumes execution as if it were not interrupted.
Interrupts vs. Procedures
Although the behavior of interrupts is analogous to procedures, there are some basic
differences that make interrupts almost indispensable. These differences are
| || Interrupts can be initiated by both software and hardware. However, procedures
can be initiated only by software.
| || Interrupt mechanism provides an efficient way to handle unanticipated events. For
example, if the program goes into an infinite loop, ctrl-break could cause an interrupt
to suspend the program execution.
| || Interrupt Service Routines are memory resident while procedures are loaded with
| || Interrupts are identified by numbers while procedures are identified by names.