Interleaving¶
Category: Foundations · Status: stub · Lessons: chapter 02, Shared state
One line: One of the many orders in which the steps of concurrent tasks can actually run; a concurrent program is correct only if it is correct under every one of them.
How it connects¶
flowchart LR
n_interleaving["Interleaving"]
n_race_condition["Race condition"]
n_interleaving -->|can cause| n_race_condition
classDef center stroke-width:3px
class n_interleaving center
classDef outside stroke-dasharray: 4 3
class n_race_condition outside
- Can lead to: Race condition
- See also: Concurrency, Nondeterminism, Preemptive scheduling
Where to read more¶
- In this library: Is total += n safe on two threads?
- In a sibling library: Go: Fan-out, fan-in ↗
- Notes: interleaving actions across threads ↗