Nondeterminism¶
Category: Foundations · Status: stub
One line: The same program with the same input gives different results on different runs, because the scheduler chose a different interleaving.
Also called: non-deterministic behaviour.
How it connects¶
flowchart LR
n_heisenbug["Heisenbug"]
n_nondeterminism["Nondeterminism"]
n_nondeterminism -->|can cause| n_heisenbug
classDef center stroke-width:3px
class n_nondeterminism center
classDef outside stroke-dasharray: 4 3
class n_heisenbug outside
- Can lead to: Heisenbug
- See also: Interleaving, Stress testing
In each language¶
| Go | The spec makes select ↗ choose among ready cases by uniform pseudo-random selection, and leaves map iteration order ↗ unspecified |
Where to read more¶
- In this library: Who waits when main returns?
- In a sibling library: Go:
selectchooses at random ↗ - In a sibling library: Go: Fan-out, fan-in ↗
- In the books: Multithreaded JavaScript, Thomas Hunter II, Bryan English — ch. 5, 'Advanced Shared Memory' → 'Timing and Nondeterminism'
- In the books: The Little Book of Semaphores, Allen B. Downey — ch. 1, 'Introduction' → 'Non-determinism'
- In the books: Functional and Concurrent Programming, Michel Charpentier — ch. 17, 'Threads and Nondeterminism'
- Notes: non-deterministic behavior - concurrency ↗
- Notes: deterministic and nondeterministic - concurrency ↗