Software Transactional Memory for OCaml

Create and use modular and composable concurrent abstractions with ease

Use familiar programming techniques

Kcas transactions are written as ordinary functions allowing you to use all the standard control flow constructs of OCaml. Furthermore, as a starting point, traditional sequential algorithms can easily be translated to parallelism-safe transactional algorithms. Transactions can be composed sequentially, conjunctively, conditionally, and disjunctively.

Leverage the work of others

Kcas comes with a companion package of parallelism-safe data structures that you can directly use for application programming. Furthermore, due to the composability of transactions and the interoperability of Kcas, independently developed data structures can be reused in new contexts.

Coordinate by awaiting on arbitrary conditions

Kcas transactions and blocking operations can await, with optional timeouts, on arbitrary conditions over the state of shared memory locations. Data structure implementations do not generally need to be a priori designed to support blocking.

Enjoy scalable performance

Kcas is based on efficient and scalable lock-free algorithms.

Learn once, write anywhere

Kcas is scheduler agnostic and can work with both existing and future schedulers.

Additional resources

Kcas: Building a Lock-Free STM for OCaml (1/2) and (2/2)

Building a lock-free STM for OCaml, see video and slides.

Kcas is part of the Multicore OCaml project and is supported by Tarides.