Trap

In computing, a trap is a program interrupt, usually caused by some exceptional situation in the user program. In most cases, the operating system performs some action, then returns control to the program. The term may also be used transitively to indicate the cause of the trap.

Description
Traps are associated with assembly language programming ("interrupt" or "" is more commonly associated with s) and appears to be fading into history among programmers as the role of assembler continues to shrink. However, it is still important to computer architects and systems hackers, who use it to distinguish ally repeatable exceptions from timing-dependent ones (such as I/O interrupts).

History
At Apple Computer in 1983, the Macintosh development team was known to use trap instructions, which used less memory than Lisa s on similar Motorola 68000 processors. As many of the early APIs for classic Mac OS were implemented as traps for the 680x0 processor family, these were replaced with native PowerPC code to improve performance of the Mac 68k emulator during the transition to PowerPC processors.