Correct option is C
To properly handle an interrupt in a system, the tasks must be performed in a specific order to ensure that the interrupt is correctly managed without losing important information. The steps are as follows:
1.
Save the contents of processor registers (C): Before servicing the interrupt, the current state of the CPU must be saved. This typically involves saving the contents of the processor registers so that the CPU can resume its previous state after the interrupt is handled. This is the first step to ensure no data is lost during the interrupt service.
2.
Check which flag is set (D): Determine which device or condition caused the interrupt. This step ensures that the system knows what specific action needs to be taken.
3.
Service the device whose flag is set (B): Perform the required service for the device or condition that caused the interrupt. This could involve reading data from a device, sending a signal, or any other necessary action.
4.
Restore the contents of processor registers (E): After servicing the interrupt, restore the saved contents of the processor registers. This step ensures that the CPU can continue executing from where it left off before the interrupt occurred.
5.
Turn on the interrupt facility (A): Finally, re-enable the interrupt system to allow the CPU to recognize and handle future interrupts.