All Exams Test series for 1 year @ ₹349 only
Question

Arrange the following events in correct order when an interrupt occurs during instruction execution.

 A. Save program counter (PC) and status register. 

B. Fetch interrupt vector from memory. 

C. Execute the interrupted instruction completely. 

D. Transfer control to interrupt service routine (ISR)

 E. Restore PC and register after ISR

Choose the correct answer from the options given below : 


 

The correct answer is
C, A, B, D, E

Interrupt Handling Sequence Explained

When an interrupt occurs during instruction execution, the processor follows a specific sequence to handle it, ensuring the system can resume correctly later. Based on the provided correct order, the events are:

  1. Complete Instruction Execution:

    The instruction that was currently being executed when the interrupt signal arrived is first completed. This ensures atomicity for the current operation.

  2. Save Processor State:

    The current state of the processor needs to be saved so that execution can be resumed later from exactly where it left off. This includes:

    • Saving the Program Counter (PC), which holds the address of the next instruction to be executed.
    • Saving the Status Register (or flags register), which contains information about the results of the latest operations and the current processor mode.
  3. Fetch Interrupt Vector:

    The processor determines which specific interrupt has occurred. It then fetches an interrupt vector from memory. This vector typically contains the starting address of the Interrupt Service Routine (ISR) designed to handle that particular interrupt.

  4. Transfer Control to ISR:

    Once the ISR's address is known, the processor transfers control to it. This means the PC is loaded with the ISR's starting address, and the ISR begins execution.

  5. Restore State After ISR:

    After the ISR has finished its tasks, the processor restores the previously saved state. This involves reloading the PC and the status register from the saved values. This allows the interrupted program to resume execution seamlessly from the point it was interrupted.

Therefore, the correct order is C, A, B, D, E.

Was this answer helpful?

Important Questions from Program Interrupt

  1. Match List-I with List-II

    List I

    List II

    a.

    Micro operation

    i.

    Specify micro operations

    b.

    Micro programmed control unit

    ii.

    Improve CPU utilization

    c.

    Interrupts

    iii.

    Control Memory

    d.

    Micro instruction

    iv.

    Elementary operation performed on data stored in registers

    Choose the correct option from those given below:

  2. Disabling an interrupt is known as ______.

  3. Which is not true about an interrupt

  4. The type $4$ interrupt represent
  5. 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?

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App