OS & Hardware

What should you keep in mind when temporarily disabling (masking) interrupts during a critical section?

  1. ALong disabled periods delay response to other interrupts, so keep them as short as possible
  2. BDisabling interrupts loses every interrupt that arrives, so they are never handled
  3. 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.
Practice this topic Back to topic

More OS & Hardware questions

  1. Why is interrupt handling split into a short part done immediately and the remainder done later in a normal context?
  2. What is the role of a page table?
  3. When does a page fault occur?
  4. When a page fault occurs on a page that was evicted to disk, what does the OS do?
  5. What is the main reason for using multilevel (hierarchical) page tables instead of a single level?