- The simplest solution is to have each process disable all interrupts just after entering its CS and re-enable them just before leaving it.
- With interrupts disabled, no clock interrupts can occur (The CPU is only switched from process to process as a result of clock or other interrupts)
- With interrupts turned off the CPU will not be switched to another process!! Thus, once a process has disabled interrupts, it can examine and update the shared memory without fear that any other process will intervene.
- This approach is generally unattractive because it is unwise to give user processes the power to turn off interrupts. Suppose that one of them did it and never turned them on again? That could be the end of the system.
- On the other hand, it is frequently convenient for the kernel itself to disable interrupts for a few instructions while it is updating variables or lists.
Cem Ozdogan
2011-02-14