What are the differences between a trap and an interrupt? What is the use of each function?
Question:
What
are the differences between a trap and an interrupt? What is the use of each
function?
Answer:
A trap is an
exception that is reported immediately following the execution of the trapping
instruction. It is a software-generated interrupt and is triggered by a user
program to invoke operating system functionality.
An interrupt is a
hardware-generated signal that changes the flow within the system. An interrupt
handler is summoned to deal with the cause of the interrupt; control is then
returned to the interrupted context and instruction.
An interrupt can be used to signal the
completion of I/O so that the CPU doesn't have to spend cycles polling the
device. A trap can be used to catch arithmetic errors or to call system
routines.
******************
Related Questions:
- What are the differences between a trap and an interrupt? What is the use of each function?
No comments:
Post a Comment