Trap (OS)

A trap is a type of exception in computing which is triggered by software or hardware.

Causes a switch to kernel mode.

  • Usually caused by software, such as a system call, debugging exception, or error condition (e.g., divide by zero or invalid memory access)

Resources

Used for System Call, exceptions, or debugging (ICD).

Trap vs. Interrupt?

https://www.baeldung.com/cs/os-trap-vs-interrupt

Traps are generally software-initiated (e.g., system calls, errors), while interrupts are hardware-initiated (e.g., I/O operations, timer signals).