CQS: A Formally-Verified Framework for Fair and Abortable Synchronization
Nikita Koval, Dmitry Khalanskiy, Dan Alistarh
摘要
Writing concurrent code that is both correct and efficient is notoriously difficult. Thus, programmers often prefer to use synchronization abstractions, which render code simpler and easier to reason about. Despite a wealth of work on this topic, there is still a gap between the rich semantics provided by synchronization abstractions in modern programming languages—specifically, fair FIFO ordering of synchronization requests and support for abortable operations—and frameworks for implementing it correctly and efficiently. Supporting such semantics is critical given the rising popularity of constructs for asynchronous programming, such as coroutines, which abort frequently and are cheaper to suspend and resume compared to native threads. This paper introduces a new framework called CancellableQueueSynchronizer (CQS), which enables simple yet efficient implementations of a wide range of fair and abortable synchronization primitives: mutexes, semaphores, barriers, count-down latches, and blocking pools. Our main contribution is algorithmic, as implementing both fairness and abortability efficiently at this level of generality is non-trivial. Importantly, all our algorithms, including the CQS framework and the primitives built on top of it, come with formal proofs in the Iris framework for Coq for many of their properties. These proofs are modular, so it is easy to show correctness for new primitives implemented on top of CQS. From a practical perspective, implementation of CQS for native threads on the JVM improves throughput by up to two orders of magnitude over Java’s AbstractQueuedSynchronizer, the only practical abstraction offering similar semantics. Further, we successfully integrated CQS as a core component of the popular Kotlin Coroutines library, validating the framework’s practical impact and expressiveness in a real-world environment. In sum, CancellableQueueSynchronizer is the first framework to combine expressiveness with formal guarantees and solid practical performance. Our approach should be extensible to other languages and families of synchronization primitives.
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了最后一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
它引用的顶会 Paper4
- RustBelt meets relaxed memoryHoang-Hai Dang, Jacques-Henri Jourdan, Jan-Oliver Kaiser, Derek DreyerPOPL 2020 · 被引用 68 次
- GoJournal: a verified, concurrent, crash-safe journaling systemTej Chajed, Joseph Tassarotti, Mark Theng, Ralf Jung 等OSDI 2021 · 被引用 31 次
- Verifying concurrent search structure templatesSiddharth Krishna, Nisarg Patel, Dennis E. Shasha, Thomas WiesPLDI 2020 · 被引用 19 次
- Fast and Scalable Channels in Kotlin CoroutinesNikita Koval, Dan Alistarh, Roman ElizarovPPoPP 2023 · 被引用 12 次
相关 Paper
- The State-of-the-Art LCRQ Concurrent Queue Algorithm Does NOT Require CAS2Raed Romanov, Nikita KovalPPoPP 2023 · 被引用 8 次
- A Design Space Exploration of Async/AwaitGavin Gray, Shriram Krishnamurthi, Will CrichtonOOPSLA 2026
- Simuliris: a separation logic framework for verifying concurrent program optimizationsLennard Gäher, Michael Sammler, Simon Spies, Ralf Jung 等POPL 2022 · 被引用 33 次
- Veracity: declarative multicore programming with commutativityAdam Chen, Parisa Fathololumi, Eric Koskinen, Jared PincusOOPSLA 2022 · 被引用 2 次
- Concurrent Data Structures Made EasyCallista Le, Kiran Gopinathan, Koon Wen Lee, Seth Gilbert 等OOPSLA 2024 · 被引用 2 次
