What is the difference between an Interrupt and a Trap (or Exception)? Give an example of when each would occur.
Last updated
An interrupt is asynchronous and raised by external hardware, independent of the current instruction (e.g. a network packet arriving or a timer firing).
A trap (exception) is synchronous and caused by the executing instruction, so it recurs if re-run (e.g. division by zero, page fault, or a system call).
Some traps are deliberate (system calls), while faults and aborts are involuntary error conditions.