Lune

PPoPP2023Top-tier venue

Fast and Scalable Channels in Kotlin Coroutines

Nikita Koval, Dan Alistarh, Roman Elizarov

Abstract

Asynchronous programming has gained significant popularity over the last decade: support for this programming pattern is available in many popular languages via libraries and native language implementations, typically in the form of coroutines or the async/await construct. Instead of programming via shared memory, this concept assumes implicit synchronization through message passing.

The key data structure enabling such communication is the rendezvous channel. Roughly, a rendezvous channel is a blocking queue of size zero, so both send(e) and receive() operations wait for each other, performing a rendezvous when they meet. To optimize the message passing pattern, channels are usually equipped with a fixed-size buffer, so sends do not suspend and put elements into the buffer until its capacity is exceeded. This primitive is known as a buffered channel.

This paper presents a fast and scalable algorithm for both rendezvous and buffered channels. Similarly to modern queues, our solution is based on an infinite array with two positional counters for send(e) and receive() operations, leveraging the unconditional Fetch-And-Add instruction to update them. Yet, the algorithm requires non-trivial modifications of this classic pattern, in order to support the full channel semantics, such as buffering and cancellation of waiting requests. We compare the performance of our solution to that of the Kotlin implementation, as well as against other academic proposals, showing up to 9.8× speedup. To showcase its expressiveness and performance, we also integrated the proposed algorithm into the standard Kotlin Coroutines library, replacing the previous channel implementations.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. Memory Bounds for Concurrent Bounded QueuesVitaly Aksenov, Nikita Koval, Petr Kuznetsov, Anton ParamonovPPoPP 2024 · 1 citation
  2. CQS: A Formally-Verified Framework for Fair and Abortable SynchronizationNikita Koval, Dmitry Khalanskiy, Dan AlistarhPLDI 2023 · 1 citation

Related papers

  1. The State-of-the-Art LCRQ Concurrent Queue Algorithm Does NOT Require CAS2Raed Romanov, Nikita KovalPPoPP 2023 · 8 citations
  2. The Complexity of Testing Message-Passing ConcurrencyZheng Shi, Lasse Møldrup, Umang Mathur, Andreas PavlogiannisPOPL 2026 · 2 citations
  3. Fuzzing channel-based concurrency runtimes using types and effectsQuentin Stiévenart, Magnus MadsenOOPSLA 2020 · 2 citations
  4. Aggregating Funnels for Faster Fetch&Add and QueuesYounghun Roh, Yuanhao Wei, Eric Ruppert, Panagiota Fatourou et al.PPoPP 2025 · 2 citations
  5. Streamline: a fast, flushless cache covert-channel attack by enabling asynchronous collusionGururaj Saileshwar, Christopher W. Fletcher, Moinuddin K. QureshiASPLOS 2021 · 36 citations
Dusk over the sea between two cliffs drawn in fine vertical lines