StreakPeaked· Practice

ExamsGATETechnical

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?

  1. (iii), (i), (ii)
  2. (i), (iii), (ii)
  3. (i), (ii), (iii)
  4. (ii), (i), (iii)

Correct answer: (iii), (i), (ii)

Solution

The correct sequence is (iii), (i), (ii) because the processor must first complete the current instruction to ensure data integrity, then save the program counter to remember where to return after handling the interrupt, and finally load the program counter with the ISR's address to begin executing the interrupt service routine.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →