A CPU generally handles an interrupt by executing an interrupt service routine
2012
A CPU generally handles an interrupt by executing an interrupt service routine
Answer: C. by checking the interrupt register after finishing execution of the current instruction — ConceptA precise interrupt is normally recognized at an instruction boundary. Completing the current instruction first leaves the processor state consistent,…
- A.
as soon as an interrupt is raised
- B.
by checking the interrupt register at the end of fetch cycle
- C.
by checking the interrupt register after finishing execution of the current instruction
- D.
by checking the interrupt register at fixed time intervals
Attempted by 29 students.
Show answer & explanation
Correct answer: C
Concept
A precise interrupt is normally recognized at an instruction boundary. Completing the current instruction first leaves the processor state consistent, so the CPU can save the return address and later resume the interrupted program correctly.
The interrupt request may become pending during an instruction, but pending does not mean that its service routine begins in the middle of that instruction.
Application
An interrupt request is raised and recorded as pending while the CPU may still be executing the current instruction.
The CPU completes that instruction, including its architectural state updates.
At the resulting instruction boundary, the CPU checks the pending interrupt, saves the context, and transfers control to the interrupt service routine.
Cross-check
On return from the service routine, execution resumes at the next instruction. That resume point is well-defined because the previous instruction was allowed to finish.
Therefore, the CPU generally checks and accepts the interrupt after finishing execution of the current instruction.