Back to the 2025 paper

Module 2: x86 Architecture, CPU Control, I/O, Memory System Design

20257m

Describe different types of interrupts: hardware, software, vectored, non-vectored, and exceptions.

Worked SolutionAI Assisted

Solution - Types of Interrupts

An Interrupt is a signal that diverts CPU from normal execution to handle an urgent event, then resumes. Classified as:

1. Hardware Interrupt (External):

  • Generated by external hardware devices (I/O, timer, power failure).
  • Asynchronous to program, via intr pins: INTR (maskable) and NMI (non-maskable) in 8086.
  • Requires hardware lines (INTR, INTA). Handled by PIC (8259).
  • Example: Keyboard press, timer tick, disk completion.

2. Software Interrupt (Internal / Programmed):

  • Generated by executing an instruction, e.g., INT n (8086), SWI, SYSCALL.
  • Synchronous, intentional. Used to invoke OS services, BIOS calls, debugging.
  • Example: INT 21h DOS service, INT 10h video, INT 3 breakpoint. Not due to failure, is a trap for system call.

3. Vectored Interrupt:

  • Device/interrupt source provides vector address (interrupt vector number). CPU uses vector to index Interrupt Vector Table (IVT) to find ISR address.
  • In 8086, IVT at 00000h has 256 vectors ×\times 4 bytes; e.g., INT n vector = n×4n \times 4.
  • Example: 8259 supplies vector for INTR; INT n is vectored. Fast response, prioritized.

4. Non-Vectored Interrupt:

  • No vector supplied; CPU branches to a single fixed address for all such interrupts.
  • CPU must poll devices to identify source (software polling). Slower.
  • Example: Some systems where multiple devices share one interrupt line without vector encoder, or 8085's RST? Actually RST is vectored - classic example is polling-based interrupts where ISR polls each device status register.

5. Exceptions:

  • Synchronous interrupts arising from CPU internal error conditions during instruction execution (often called traps/faults).
  • Subtypes:
    • Fault: Re-executable after handling (e.g., Page fault, divide by zero) - returns to faulting instruction.
    • Trap: Reported after instruction execution (e.g., overflow, breakpoint TRAP).
    • Abort: Severe unrecoverable error (e.g., machine check, double fault) - no precise return.
  • Examples: Divide by zero (#DE), General Protection Fault (#GP), Page Fault (#PF) in x86 protected mode, Undefined opcode, Overflow.
  • Exceptions are synchronous and often vectored (IDT vectors 0-31 reserved in x86).

Additional Classification:

  • Maskable vs Non-Maskable: INTR can be disabled via IF flag; NMI cannot.
  • Priority: NMI > Exceptions > INTR.

Handling Flow (x86-like): Finish current instruction -> push FLAGS, CS:IP -> clear IF/TF -> load CS:IP from vector table -> execute ISR -> IRET restores context.

Similar questions

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.