OS & Hardware
What should you keep in mind when temporarily disabling (masking) interrupts during a critical section?
- ALong disabled periods delay response to other interrupts, so keep them as short as possible
- BDisabling interrupts loses every interrupt that arrives, so they are never handled
- CDisabling interrupts greatly increases CPU power, so it must never be used
Show answer and explanation
Answer: A. Long disabled periods delay response to other interrupts, so keep them as short as possible
Disabling interrupts keeps a shared-data update from being interrupted midway, but interrupts arriving meanwhile must wait. Long disabled periods delay communication and timer handling, risking lost data or slow responses, so the critical section should be as short as possible. Arriving interrupts are usually held pending and handled once interrupts are re-enabled, so they are not all lost. Power does not rise significantly either.
- A. Correct. Keep the section short to avoid delayed responses.
- B. Interrupts are usually held pending and handled after re-enabling.
- C. Masking interrupts does not greatly increase power.