Saturn: a library of verified concurrent data structures for OCaml 5
Résumé
We present Saturn, a new OCaml 5 library available on opam. Saturn offers a collection of efficient concurrent data structures: stack, queue, skiplist, hash table, workstealing deque, etc. It is well tested, benchmarked and in part formally verified.
Sharing data between multiple threads or cores is a well-known problem. A naive approach is to take a sequential data structure and protect it with a lock. However, this approach is often inefficient in terms of performance, as locks introduce significant contention. Additionally, it may not be a sound solution as it can lead to liveness issues such as deadlock, starvation, and priority inversion.
In contrast, lock-free implementations, which rely on fine-grained synchronization instead of locks, are typically faster and guarantee system-wide progress. However, they are also more complex and come with their own set of bugs, such as the ABA problem (largely mitigated in garbage-collected languages), data races, and unexpected behaviors due to non-linearizability.
In this context, Saturn provides a collection of standard lock-free data structures, saving OCaml 5 programmers the trouble of designing their own. Currently, there is no similar project available for OCaml 5 in opam. Most OCaml 5 developers currently choose to write their own data structures, which is error-prone and time-consuming.
Domaines
| Origine | Fichiers produits par l'(les) auteur(s) |
|---|---|
| Licence |