saturn icon indicating copy to clipboard operation
saturn copied to clipboard

CQS

Open kayceesrk opened this issue 2 years ago • 2 comments

From the abstract

We introduce a new framework called the CancellableQueueSynchronizer (CQS), which enables efficient fair and abortable implementations of fundamental synchronization primitives such as mutexes, semaphores, barriers, count-down-latches, and blocking pools. Our first contribution is algorithmic, as implementing both fairness and abortability efficiently at this level of generality is non-trivial. Importantly, all our algorithms come with formal proofs in the Iris framework for Coq. These proofs are modular, so it is easy to prove correctness for new primitives implemented on top of CQS. To validate practical impact, we integrated CQS into the Kotlin Coroutines library. Compared against Java's AbstractQueuedSynchronizer, the only practical abstraction to provide similar semantics, CQS shows significant improvements across all benchmarks, of up to two orders of magnitude. In sum, CQS is the first framework to combine expressiveness with formal guarantees and strong practical performance, and should be extensible to other languages and other families of synchronization primitives.

I would think that we can make this work with effects.

[1] https://arxiv.org/abs/2111.12682 [2] https://nikitakoval.org/talks/#hydra-2020-sqs

kayceesrk avatar Dec 12 '22 05:12 kayceesrk

cc @talex5 who mentioned this

bartoszmodelski avatar Dec 12 '22 11:12 bartoszmodelski

Yeah, it's tracked in https://github.com/ocaml-multicore/eio/issues/382

I have a prototype mostly working now.

talex5 avatar Dec 12 '22 12:12 talex5