English

Reciprocating Locks

Distributed, Parallel, and Cluster Computing 2025-07-14 v9

Abstract

We present "Reciprocating Locks", a novel mutual exclusion locking algorithm, targeting cache-coherent shared memory (CC), that enjoys a number of desirable properties. The doorway arrival phase and the release operation both run in constant-time. Waiting threads use local spinning and only a single waiting element is required per thread, regardless of the number of locks a thread might hold at a given time. While our lock does not provide strict FIFO admission, it bounds bypass and has strong anti-starvation properties. The lock is compact, space efficient, and has been intentionally designed to be readily usable in real-world general purpose computing environments such as the linux kernel, pthreads, or C++. We show the lock exhibits high throughput under contention and low latency in the uncontended case. The performance of Reciprocating Locks is competitive with and often better than the best state-of-the-art scalable spin locks.

Keywords

Cite

@article{arxiv.2501.02380,
  title  = {Reciprocating Locks},
  author = {Dave Dice and Alex Kogan},
  journal= {arXiv preprint arXiv:2501.02380},
  year   = {2025}
}

Comments

Added additional variations in appendix, at the request of collaborators who want to prove various properties