Skip to main content

GATE CSE 2025CO & Architecture › I/O Handling, Interrupts & DMAVerified

GATE CSE 2025 PYQ: Suppose a program is running on a non-pipelined single processor computer system. The computer is connected…

Suppose a program is running on a non-pipelined single processor computer system. The computer is connected to an external device that can interrupt the processor asynchronously. The processor needs to execute the interrupt service routine (ISR) to serve this interrupt. The following steps (not necessarily in order) are taken by the processor when the interrupt arrives:

  1. The processor saves the content of the program counter.
  2. The program counter is loaded with the start address of the ISR.
  3. The processor finishes the present instruction.

Which ONE of the following is the CORRECT sequence of steps?

  1. A
    (iii), (i), (ii)\text{(iii), (i), (ii)}
    Correct answer
  2. B
    (i), (iii), (ii)\text{(i), (iii), (ii)}
  3. C
    (i), (ii), (iii)\text{(i), (ii), (iii)}
  4. D
    (iii), (ii), (i)\text{(iii), (ii), (i)}

Answer

(A) (iii), (i), (ii) \text{(iii), (i), (ii)} (iii), (i), (ii)

Approach

Reason about what the CPU must do at the instant an asynchronous interrupt is raised. Because the processor must not abandon a partially executed instruction (that would leave registers and memory in an inconsistent state), it first completes the instruction currently in the pipeline. Only after that does it preserve the point at which the main program must resume, and finally it redirects control to the ISR. This directly fixes the order as finish instruction → save PC → load ISR address, i.e. (iii), (i), (ii).

Interrupts are recognized only between instructions, so the CPU first completes the current instruction (iii), then preserves the return address by saving the PC (i), and only then transfers control by loading the ISR start address into the PC (ii). This is option A.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.