What’s the difference between trap and interrupt?
An interrupt is a hardware-generated event, usually caused by an I/O device requesting service. The interrupt signal causes a change of °ow within the system: an interrupt service routine (ISR) saves the CPU state, services the interrupt, then restores control to the interrupted process. A trap, on the other and, is a software-generated interrupt. Traps are caused by 1) system calls and 2) exceptional software conditions (e.g. divide by 0). Other than the source and function, processing of traps and interrupts is the same.
