Using STM for Modular Concurrency: An Industrial Experience Report on Software Transactional Memory
summary
Industrial Cardano node reimplementation uses Haskell STM pervasively and claims STM scales to a large, security-sensitive, concurrent system built over ~20 months. Design uses a pull-based cue-less design with components exposing STM queries as observables (unidirectional TVar ownership, fingerprints to detect relevant changes) and composes guarded actions with orElse alternatives and retry. Timeouts use registered-delay TVars. Testing runs the exact production code in a pure deterministic simulator with deterministic simulation with QuickCheck, finds many bugs, and prevents production failures.
AI-written summary · about
chapters (19)
- 0:00Intro
- 1:06Summary
- 4:04Project context
- 5:49Background ideas
- 8:21The STM primitives
- 12:33Blocking on alternatives
- 15:50Design thought process
- 20:29Observing relevant changes
- 24:57Acting on the current state
- 26:56A real example: block fetch
- 30:13A modular variation on the state observation pattern
- 31:34Modular guarded actions
- 32:57A real example: Peer-to-peer control loop
- 33:57Testing
- 35:03Simulation
- 41:56Use of STM within Cardano
- 45:18Contrast with message passing
- 47:05Conclusion
- 48:01Acknowledgements
related talks
01h 33mWhy You Should Use Software Transactional Memory
01h 00mWhat did C++ do for Transactional Memory?
36mATOMICALLY { DELETE YOUR ACTORS }
01h 03m“Transactional Memory in Practice"
52mSTM and Structured Concurrency — The Battle with Multithreading Dragons
27mOpen Transactional Actions: Interacting with non-transactional resources in S...
22mBuilding a lock-free STM for OCaml
20mFour Years of Embedded Haskell in Critical Real-Time Systems: Lessons and Insights
