Machine-translated by Google. Questions are authored in English.
Top

Discussion

The following are some events that occur after a device controller issues an interrupt while process \(L\) is under execution.

(P) The processor pushes the process status of \(L\) onto the control stack.
(Q) The processor finishes the execution of the current instruction.
(R) The processor executes the interrupt service routine.
(S) The processor pops the process status of \(L\) from the control stack.
(T) The processor loads the new PC value based on the interrupt.

Which one of the following is the correct order in which the events above occur?

  • A.QPTRS
  • B.PTRSQ
  • C.TRPQS
  • D.QTPRS

Answer: A

The correct order is QPTRS.

  1. (Q) The processor finishes the instruction it is executing; interrupts are checked between instructions.
  2. (P) It saves the status of process L on the control stack, so L can be resumed.
  3. (T) It loads the PC with the address of the interrupt service routine.
  4. (R) It runs the interrupt service routine.
  5. (S) It restores L's status from the stack and L continues.

PTRSQ saves the status before the current instruction completes, TRPQS jumps to the handler without first saving L's state, and QTPRS loads the new PC before saving the old state, which would lose L's return address.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.