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 "exception" is more commonly associated with high-level programming languages) 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 deterministically 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 system calls on similar Motorola 68000 processors.[1] 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.[2]
References
- ↑ RMaker by Andy Hertzfeld, Folklore. 1983-03.
- ↑ Simple Porting to The Power Mac by Chris Forden, MacTech vol.10, no.5. 1994-05.
External links
- Trap (computing) at Wikipedia