Flash-Sale Inventory Race Condition — 2D
Interactive 2D simulator of mobile-checkout overselling: a scrolling stock-level chart and request timeline show concurrent buy requests racing a shared stock counter under no locking, optimistic concurrency (CAS) and pessimistic locking, with the exact pipeline-depth formula for how many units get oversold.
Mobile e-commerce checkout is a textbook concurrency problem: many devices read the same stock count, wait through a network-plus-database round trip, then write a decision. This 2D companion trades the spatial silo-and-tokens view for a diagnostic instrument-panel: a scrolling stock-level chart shows the live counter dipping below zero, and a scrolling request timeline shows every checkout as a horizontal bar from spawn to resolution, colored orange while in flight, green when sold, red when rejected. Switch between no locking, optimistic concurrency (compare-and-swap on a version number) and pessimistic locking (a strict FIFO queue) while tuning starting stock, checkout rate and round-trip latency, and watch the "pipeline depth" readout — rate × latency — predict, in real time, exactly how many units No Lock will oversell.
A scrolling 2D stock-level chart and request timeline replay the classic mobile-checkout race condition: compare no locking, optimistic concurrency (CAS) and pessimistic locking, and watch a live pipeline-depth readout predict exactly how many units No Lock oversells.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install