In
computing and
operating systems, a trap, also known as an exception or a fault, is typically
[There is a wide variation in the nomenclature. On some computers the term ''trap'' refers to any interrupt, on some machines to any synchronous interrupt, on some machines to any interrupt not associated with input/output, on some machines only to interrupts caused by instructions with ''trap'' in their names, etc.] a type of
synchronous interrupt caused by an
exceptional condition (e.g.,
breakpoint,
division by zero,
invalid memory access). A trap usually results in a switch to
kernel mode, wherein the operating system performs some action before returning control to the originating process. A trap in a kernel
process is more serious than a trap in a user process, and in some systems is
fatal. In some usages, the term ''trap'' refers specifically to an interrupt intended to initiate a
context switch to a
monitor program or
debugger.
Deriving from this original usage, ''trap'' is sometimes used for the mechanism of intercepting normal
control flow in some domains.
In
SNMP, a trap is a type of
PDU used to report an alert or other asynchronous event about a managed subsystem.
See also
*
Software bug
*
Exception handling
Notes
{{reflist|group=NB
References
Category:Computing terminology
Category:Unix