Mutual Exclusion

Interrupt Disabling

In a uniprocessor system, concurrent processes cannot have overlapped execution; they can only be interleaved. Furthermore, a process will continue to run until it invokes an OS service or until it is interrupted.

Therefore, to guarantee mutual exclusion, it is sufficient to prevent a process from being interrupted. This capability can be provided in the form of primitives defined by the OS kernel for disabling and enabling interrupts. A process can then enforce mutual exclusion in the following way:

while (true) {
/* disable interrupts */;
/* critical section */;
/* enable interrupts */;
/* remainder */;

Because the critical section cannot be interrupted, mutual exclusion is guaranteed.

Problem #1: Low efficiency

The efficiency of execution could be noticeably degraded because the processor is limited in its ability to interleave processes.

Problem #2: Does not work in Multiprocessor Architecture

When the computer includes more than one processor, it is possible (and typical) for more than one process to be executing at a time. In this case, disabled interrupts do not guarantee mutual exclusion.