System Software, Architecture, Memory And Storage Practice Test

Access More Questions
What can cause a context switch after an interrupt service routine completes?
Correct Answer:
The scheduler may switch to a higher-priority ready task after the ISR.
Explanation:
After an interrupt service routine finishes, the system often runs the scheduler to decide what to execute next. In a preemptive system, an ISR can wake up or unblock a higher-priority task. When the ISR returns, the scheduler sees that a higher-priority task is now ready and performs a context switch to that task, saving the state of the current task and loading the state of the higher-priority one. This is why a context switch after an ISR is possible and often expected: the interrupt may reveal more urgent work that should run immediately. This isn’t guaranteed to always resume the interrupted task, because if a higher-priority task became ready during the ISR, the scheduler will switch to that task. It’s also not accurate to say there’s no context switch after an ISR in a system with preemption, since the exit from the ISR is precisely when the scheduler decides whether a switch is needed. The idea that the interrupt preempts the current thread until it completes is a misunderstanding of how scheduling and ISR handling interact: the ISR runs, then the scheduler decides if a higher-priority task should run next, which can involve a context switch.

Access more questions from this quiz

Continue to System Software, Architecture, Memory and Storage Practice Test for more practice questions and the full quiz experience.

Access More Questions