Hi everyone! I’m happy to share updates on new releases of multicore libraries. KC’s blog post provides an excellent overview of the big picture and how the developments in the compiler, libraries and tooling fit together.
I’m delighted to present to my fellow camlers Saturn and Saturn_lockfree, now available in opam-repository. Saturn is the new alter ego of our old friend lockfree. Saturn (and its sub-libraries) subsume lockfree, and aim to be a collection of parallelism-safe data structures for OCaml 5.
Saturn_lockfree provides a set of lockfree and lock-based structures that are well tested. Furthermore, cache-aligned atomics recently landed on trunk OCaml, which opens up exciting possibilities to explore for lock-free algorithms.
The renaming stems from a desire to expand the scope of the library to be more than just lockfree. Essentially a data-structure can be blocking, lock-free or sometimes partially lock-free ( and not defined in other times). We ran into intriguing questions such as “When is a structure lock-free, really?” in the process of developing them.
Considering the perspective of a user of parallelism-safe data structures, whether they are transitioning their libraries to OCaml 5 or building something from scratch, it’s reasonable to assume that their primary concerns would be the correctness and performance of these structures, rather than the nitty-gritties of progress conditions. These structures are model-checked and have a good set of property based tests. They have some benchmarks with more on the way. Saturn aims to be a collection of reliable and performant parallelism-safe data structures.
Amongst other things, Saturn will host:
- Lockfree structures
- Composable lockfree structures from kcas_data
- Lock-based parallelism-safe data structures
The README has comprehensive descriptions for the above-mentioned items (as well as more details coming soon). Here is the changelog.
DSCheck is an experimental model checker for testing concurrent programs. Concurrency bugs can be notoriously hard to track down. DScheck explores the possible interleavings of concurrent programs, thereby helping us catch potential bugs early on. It manages to do this by a neat combination of exploring branches needs to be explored, and mocking parallelism with effect handlers.
Changelog for the latest release is here. The major improvement this release contains is the Source Sets approach for optimal reduction. This is has hugely reduced the number of branches to explore in the tree of possible interleavings, and thereby improving the performance by a great margin. The next release will hopefully include granular dependency relation for the DPoR algorithm, which further speeds up the dscheck tests by over 5x.
Domainslib provides easy ways to write nested parallel programs in OCaml 5. Amongst other things, the 0.5.1 release supports domain-local-await (DLA), enabling smooth interoperability with other libraries supporting DLA such as Eio, Kcas, Moonpool and so on. This opens up interesting possibilities to juxtapose domainslib for parallelism and Eio for IO, in the same application. Furthermore, this release includes a
parallel_find which helps propagate exceptions.
This new release contains feature additions such as extending
Eio.Condition, removing deprecated functions and bug fixes. As we’re heading towards a 1.0 release of Eio, we hope to share more frequent updates on Eio.
In tandem, a number of applications are migrating to Eio to exploit OCaml 5 features. You can find many of them at awesome-multicore-ocaml. For folks interested in this, @talex5 and @jonludlam are running a tutorial at ICFP on the same subject.