What is the main disadvantage of Peterson’s solution for mutual exclusion?
2026
What is the main disadvantage of Peterson’s solution for mutual exclusion?
Answer: B. It fails on modern multi-core CPUs due to memory reordering — A correct critical-section solution must satisfy three conditions: mutual exclusion, so no two processes execute in their critical sections at the same time;…
- A.
It does not ensure progress
- B.
It fails on modern multi-core CPUs due to memory reordering
- C.
It causes external fragmentation
- D.
It requires high memory access time
Attempted by 124 students.
Show answer & explanation
Correct answer: B
A correct critical-section solution must satisfy three conditions: mutual exclusion, so no two processes execute in their critical sections at the same time; progress, so a process wanting to enter is not delayed indefinitely by processes not interested in entering; and bounded waiting, so there is a finite bound on how many times other processes enter before a waiting process is served. Peterson's algorithm achieves all three purely through ordinary shared variables — a turn variable and a per-process flag array — with no special hardware instructions, but its correctness proof rests on the memory-access model of the machine: it assumes reads and writes to shared variables complete in the exact order they appear in the program, a property known as sequential consistency.
Modern multi-core and multiprocessor systems do not guarantee that assumption by default. To improve performance, compilers reorder independent-looking instructions and CPUs use per-core caches, store buffers, and out-of-order execution, so a write one process makes to its flag or to turn may not become visible to another core in the same order it was issued, unless the program explicitly inserts a memory barrier or fence. Because Peterson's proof depends entirely on strict ordering of these reads and writes, running the unmodified algorithm on such hardware can let both processes enter the critical section at the same time, breaking mutual exclusion even though the algorithm's logic looks correct on paper.
Checking each remaining option against this reasoning:
It does not ensure progress — progress is a formally proven property of Peterson's algorithm under the classical, sequentially consistent model; the algorithm's construction, where each process yields via the flag and turn check, is specifically designed so a process not seeking entry never blocks another. This is not the property affected by moving to modern hardware.
It causes external fragmentation — external fragmentation is a memory-allocation phenomenon, the leftover unusable gaps between allocated blocks in contiguous or segmented memory schemes; Peterson's algorithm only reads and writes two small shared variables and has no relation to how memory blocks are allocated.
It requires high memory access time — memory access time is a hardware and memory-hierarchy property, governed by cache and RAM latency, independent of which synchronization algorithm a program uses; Peterson's algorithm does not impose any unusual memory-access cost.
Cross-checking against how real systems handle this: production synchronization primitives such as mutexes and spinlocks are built on hardware atomic instructions like test-and-set or compare-and-swap, combined with explicit memory fences, precisely because plain load and store based algorithms like Peterson's cannot be trusted to work correctly on modern multi-core CPUs without such support. This confirms that the main disadvantage lies in Peterson's incompatibility with modern multi-core hardware, not in progress, fragmentation, or memory-access time.