#interrupts

LIVE

An interrupt signals the occurrence of an event the kernel should be aware of. Hardware can trigger an interrupt at any time by sending a signal to the CPU, usually through the system bus; software can trigger an interrupt by executing a system call (also called a monitor call). When an interrupt occurs, the CPU stops what it is doing and transfers execution to a fixed location, which usually contains the starting address where the service routine for the interrupt is located. After the routine finishes, the CPU resumes what was interrupted.

Interrupts are an important part of a computer’s architecture. They transfer control to the appropriate interrupt service routine, which is usually defined in an interrupt vector, or array holding the addresses of interrupt service routines for various devices. Modern operating systems are interrupt driven, and events are almost always signaled by the occurrence of an interrupt or a trap.

Atrap, or an exception, is a software-generated interrupt caused either by an error (division by zero, segmentation fault, etc.) or by a request from the user program for an operating system service.

In x86, the IDT (interrupt descriptor table) provides pointers to interrupt and exception routines.

loading