The occurrence of an event is usually signaled by an interrupt from either the hardware or the software. Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus. The software may trigger an interrupt by executing a special operation called a system call (also called a monitor call).
Trap is a software-generated signal either to call operating system routine or to catch the exceptional condition (e.g., breakpoint, division by zero, invalid memory access). It is a type of synchronous non-musk able interrupt. the Trap has highest priority and vectored interrupt. Trap usually results in a switch to kernel mode, wherein the operating system performs some action before returning control to the originating process.
Mechanisms for interrupting the execution of a process