Quote:
Originally Posted by axiomofdarkness
What would an interrupt be then?
|
The hardware generates an electrical signal (called an interrupt) that causes the CPU to stop what it's doing, save its "context", jump to a new location in program memory, and start executing there. That location is called an ISR -- interrupt service routine. When the ISR is done executing, it tells the CPU to go back to where it was when the interrupt occurred. The CPU uses the saved "context" to go back to where it was, as it was.
You can see there is no polling involved. That's the advantage of interrupts.
The disadvantage is that interrupts can occur at any time -- asynchronously -- so you have to be careful when using them.