A high-performance implementation of composable Transactional Memory for Common Lisp, enabling easier concurrent programming.
STMX is a high-performance implementation of composable Transactional Memory (TM) for Common Lisp, designed to simplify concurrent programming. It replaces traditional lock-based approaches with atomic memory transactions, which can be composed to build larger atomic operations, making concurrent code easier to write and understand by eliminating deadlocks and race conditions.
Common Lisp developers building concurrent applications who need to manage shared state safely and efficiently, particularly those targeting systems where performance and composability are critical.
Developers choose STMX for its high performance, especially when hardware acceleration (Intel TSX) is available, and its unique composability feature that allows smaller transactions to be combined into larger ones without modification, simplifying code reuse and integration.
High performance Transactional Memory for Common Lisp
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages Intel TSX for hardware transactions on compatible CPUs, achieving over 35 million transactions per second per core in benchmarks, making it exceptionally fast for compiled SBCL code.
Smaller atomic blocks can be combined into larger ones without modification, enabling flexible code reuse, such as atomically moving objects between unrelated transactional containers.
Transactions run in parallel and automatically re-execute on conflicts or inconsistent reads, with the RETRY function allowing threads to wait for data changes, simplifying thread communication.
Provides transactional versions of common structures like cells, lists, hash tables, and sorted maps, reducing boilerplate for implementing thread-safe containers.
Peak performance relies on Intel TSX, which is disabled on many CPUs due to hardware bugs, forcing software fallbacks that are 4-5 times slower, as noted in the README's news updates.
Does not prevent irreversible operations like I/O inside atomic blocks, trusting developers to avoid them; missteps can cause unintended side effects due to re-execution, a risk the README explicitly warns about.
Optimized for SBCL with poor performance on other implementations like CCL or ECL, and requires manual ASDF upgrades for older versions, adding setup complexity.
Allows accessing transactional data outside atomic blocks for debugging, but this is intended only for REPL use and can lead to inconsistencies in programs, with future versions possibly removing this feature.