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 instructionConceptA precise interrupt is normally recognized at an instruction boundary. Completing the current instruction first leaves the processor state consistent,…

  1. A.

    as soon as an interrupt is raised

  2. B.

    by checking the interrupt register at the end of fetch cycle

  3. C.

    by checking the interrupt register after finishing execution of the current instruction

  4. 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

  1. An interrupt request is raised and recorded as pending while the CPU may still be executing the current instruction.

  2. The CPU completes that instruction, including its architectural state updates.

  3. 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.

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…