Skip to main content

NimbusKV Interactive Concurrency Lab

Explore race condition mechanics, atomic coordination without CAS retry collapse, lock-free snapshot reads, and generational TTL life-cycles.

Interactive Visual Simulation: Step-by-step visualizer for concurrent thread execution and snapshot transitions. To benchmark physical multi-core execution without GIL, run python -m bench.b06_write_path locally on Python 3.13t/3.14t.
Deterministic Simulator
Step 1 of 5

Initial State

Initial State

Counter key exists in shared store with value 42. Two worker threads (Thread A and Thread B) are spawned.

Thread A (Worker 1)ready
Action:Idle
Register Cache: empty
Shared Memory StoreHAMT Root
Key 'counter':42
Write Mutex:Unlocked (Free)
Thread B (Worker 2)ready
Action:Idle
Register Cache: empty
Python Program (Scenario 1 — The Race (Lost Updates))
# Race Condition: Ordinary read-modify-write in standard dict
# Worker A and Worker B both read 42 simultaneously
# Both compute 43 and write back -> Final value is 43 (Expected: 44!)

def worker():
    current = store.get("counter")  # Both read 42
    time.sleep(0.001)               # Thread switch occurs here
    store.set("counter", current + 1) # Overlapping writes!