<P> A software interrupt is caused either by an exceptional condition in the processor itself, or a special instruction in the instruction set which causes an interrupt when it is executed . The former is often called a trap or exception and is used for errors or events occurring during program execution that are exceptional enough that they cannot be handled within the program itself . For example, a divide - by - zero exception will be thrown if the processor's arithmetic logic unit is commanded to divide a number by zero as this instruction is an error and impossible . The operating system will catch this exception, and can decide what to do about it: usually aborting the process and displaying an error message . Software interrupt instructions can function similarly to subroutine calls and are used for a variety of purposes, such as to request services from device drivers, like interrupts sent to and from a disk controller to request reading or writing of data to and from the disk . </P> <P> Each interrupt has its own interrupt handler . The number of hardware interrupts is limited by the number of interrupt request (IRQ) lines to the processor, but there may be hundreds of different software interrupts . Interrupts are a commonly used technique for computer multitasking, especially in real - time computing . Such a system is said to be interrupt - driven . </P> <P> Interrupts are similar to signals, the difference being that signals are used for inter-process communication (IPC), mediated by the kernel (possibly via system calls) and handled by processes, while interrupts are mediated by the processor and handled by the kernel . The kernel may pass an interrupt as a signal to the process that caused it (typical examples are SIGSEGV, SIGBUS, SIGILL and SIGFPE). </P> <P> Hardware interrupts were introduced as an optimization, eliminating unproductive waiting time in polling loops, waiting for external events . The first system to use this approach was the DYSEAC, completed in 1954, although earlier systems provided error trap functions . Interrupts may be implemented in hardware as a distinct system with control lines, or they may be integrated into the memory subsystem . </P>

When does the cpu check for an interrupt