A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Interrupt Vector Tables and Dispatch

College Depth 97 in the knowledge graph I know this Set as goal
3topics build on this
363prerequisites beneath it
See this on the map →
Interrupts and Direct Memory Access (DMA)CPU Control UnitException Handling: OS Internals
interrupts hardware dispatch

Core Idea

When a hardware interrupt or exception occurs, the CPU consults an interrupt vector table indexed by interrupt number to find the handler address. This enables the OS to dispatch control rapidly without querying what caused the interrupt.

Explainer

From your study of interrupt and exception handling, you know that hardware devices signal the CPU when they need attention — a keyboard press, a disk transfer completing, a timer tick. The CPU must stop what it is doing and jump to the appropriate handler code in the operating system. The question is: how does the CPU know *where* to jump? It cannot run a search through kernel code looking for the right handler. Interrupts happen millions of times per second, so the dispatch mechanism must be essentially instant.

The answer is the interrupt vector table (IVT), sometimes called the interrupt descriptor table (IDT) on x86 processors. This is simply an array stored at a known memory address, where each entry corresponds to a specific interrupt number. Entry 0 might point to the divide-by-zero exception handler. Entry 14 points to the page fault handler. Entry 32 might point to the timer interrupt handler. When interrupt number *k* fires, the CPU indexes into the table at position *k*, reads the address stored there, and jumps to that address. The entire dispatch is a single array lookup — no conditionals, no searching, just one indexed memory access followed by a jump.

The operating system populates the interrupt vector table during boot. For each interrupt number, the kernel writes the address of the corresponding handler function into the table. Some entries are fixed by the hardware architecture — for instance, on x86, interrupts 0–31 are reserved for CPU exceptions (divide error, page fault, general protection fault, etc.). The remaining entries (32–255 on x86) are available for hardware devices and software interrupts. When a device like a network card is initialized, its driver registers a handler by writing the handler's address into the appropriate slot. The CPU itself knows the table's base address because the OS loads it into a special register (the IDTR on x86) during startup.

The dispatch process involves more than just jumping to a handler. When an interrupt fires, the CPU automatically saves critical state — at minimum the instruction pointer and flags register — onto the stack so it can resume the interrupted code later. On x86, the CPU also switches to a kernel stack if the interrupt occurred while running user code, enforcing the privilege boundary you studied in kernel mode and privilege levels. After the handler finishes (typically by executing an `iret` instruction), the saved state is restored and execution resumes exactly where it left off. This save-dispatch-handle-restore cycle is the fundamental mechanism by which the OS responds to hardware events while maintaining the illusion that user programs run uninterrupted.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationOverflow and Underflow DetectionBinary Adders: Half-Adders and Full-AddersFull Adder and Carry PropagationCarry Lookahead Adder DesignHalf Adder Circuit DesignMultiplication Circuit DesignSequential Circuit DesignRegisters and Register FilesInstruction Set Architecture (ISA)Assembly Language BasicsMemory Organization and AddressingMemory Address DecodingMemory Bus Architecture and InterconnectI/O Systems and BusesInterrupts and Direct Memory Access (DMA)Interrupt Vector Tables and Dispatch

Longest path: 98 steps · 363 total prerequisite topics

Prerequisites (2)

Leads To (1)