What You'll Learn
You'll learn how the interrupt vector table organizes interrupt handler addresses so the CPU can quickly respond to different interrupt events.
What Is the Interrupt Vector Table?
The Interrupt Vector Table (IVT) is a data structure stored in memory that maps each possible interrupt number (or interrupt ID) to the memory address of its corresponding handler routine. Think of it as a telephone directory: when an interrupt arrives with a specific number, the CPU looks up that number in the table to find where the handler code begins, then jumps there immediately.
When an interrupt occurs, the CPU receives an interrupt number (sometimes called a vector number). Rather than searching through code or using conditional logic, the CPU uses this number as an index into the IVT. The table entry at that index contains the starting address of the interrupt service routine (ISR) that should handle this particular interrupt.
How It Works
- Interrupt arrives with number n (e.g., interrupt #5 for keyboard input)
- CPU reads IVT entry at position n (often calculated as:
IVT_base_address + n × entry_size) - CPU jumps to the handler address stored in that entry
- Handler executes and services the interrupt
- CPU returns to interrupted program
Why Use an IVT?
Direct table lookup is extremely fast—just a single memory read followed by a jump. Without an IVT, the OS would need conditional branches or searches to find the right handler, wasting precious cycles during time-critical interrupt processing.
The IVT location is typically fixed at a known memory address (often near the start of memory) so the CPU hardware can find it instantly.
Key Takeaway: The interrupt vector table provides efficient interrupt dispatch by mapping interrupt numbers directly to handler addresses through simple array indexing, enabling fast response to hardware and software events.