Definition:

  • used to handle conditions that arise when executing instructions on the processor
  • Detected by the processor itself
  • Used in:
    • Allow user programs to get service from the OS
      • A system call creates an exception that kicks out the user program and transfers control to exception handler, which will invoke a proper OS service routine
  • Handle unexpected events: Memory protection violation, divide-by-zero, invalid opcode, etc.
  • Handle Page Fault
    • when instruction requested is TLB-miss and Page table-miss
    • CPU generates a page fault exception
    • Exception handler saves program state and transfers control to the OS
    • OS brings in the pages, updates page tables and TLB, restores program state and resum the program
    • Execute the instruction