Question

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:

(i) The processor saves the content of the program counter.
(ii) The program counter is loaded with the start address of the ISR.
(iii) The processor finishes the present instruction.

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

Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2025 answer key

Solution

Trace the hardware interrupt-acknowledge cycle at the boundary of an instruction execution cycle.

When an asynchronous external interrupt arrives during instruction execution:

  1. (iii) The processor first completes the execution of the current instruction (it checks the interrupt line only at the end of the instruction cycle).
  2. (i) Before branching to the ISR, the processor saves the current Program Counter (PC) (the address of the next instruction) onto the stack or into a link register so execution can resume later.
  3. (ii) Finally, the PC is loaded with the starting address of the ISR.

Hence the correct sequence is (iii), (i), (ii).

Final answer

Option (A)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2025 Computer Science and Information Technology - Session 1 (CS1)
Question
11 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.