When an interrupt is requested, the currently running process is suspended and the handler is
invoked. When the handler exits, control is handed back to the running process. Since interrupts are
practically random and unplanned, when the handler passes back control, it must ensure that all
registers and stacks that it used are restored back to the exact state they were in when the process
got interrupted, so that the process can resume like as though nothing happened.
Access to these registers and stacks can only be done in assembly.
Other reasons include the fact that interrupt handlers must be very fast, and since the interrupt
routines are very short, they can be hand‐crafted to be much faster than anything a compiler
generates.
Chat with our AI personalities
Interrupt handlers are often written in assembly language to ensure that they execute quickly.