Skip to main content
QUICK REVIEW

[Paper Review] Concurrent Reference Counting and Resource Management in Wait-free Constant Time

Guy E. Blelloch, Yuanhao Wei|arXiv (Cornell University)|Feb 17, 2020
Distributed systems and fault tolerance26 references6 citations
TL;DR

This paper presents a lock-free, wait-free concurrent reference counting mechanism using an acquire-retire interface that ensures constant-time overhead and bounded space for resource management. By leveraging single-word atomic operations and a four-primitive interface (acquire, release, retire, eject), it enables efficient, race-free memory and resource reclamation with expected O(1) performance across multiple workloads, outperforming existing lock-based and lock-free alternatives in high-contention scenarios.

ABSTRACT

A common problem when implementing concurrent programs is efficiently protecting against unsafe races between processes reading and then using a resource (e.g., memory blocks, file descriptors, or network connections) and other processes that are concurrently overwriting and then destructing the same resource. Such read-destruct races can be protected with locks, or with lock-free solutions such as hazard-pointers or read-copy-update (RCU). In this paper we describe a method for protecting read-destruct races with expected constant time overhead, $O(P^2)$ space and $O(P^2)$ delayed destructs, and with just single word atomic memory operations (reads, writes, and CAS). It is based on an interface with four primitives, an acquire-release pair to protect accesses, and a retire-eject pair to delay the destruct until it is safe. We refer to this as the acquire-retire interface. Using the acquire-retire interface, we develop simple implementations for three common use cases: (1) memory reclamation with applications to stacks and queues, (2) reference counted objects, and (3) objects manage by ownership with moves, copies, and destructs. The first two results significantly improve on previous results, and the third application is original. Importantly, all operations have expected constant time overhead.

Motivation & Objective

  • To address the read-destruct race problem in concurrent systems where threads may access or destroy shared resources simultaneously.
  • To design a lock-free, wait-free mechanism for resource management that ensures timely destruction and avoids the performance bottlenecks of locks.
  • To generalize existing memory reclamation techniques by supporting multiple retires per resource and a copy-destruct interface for broader applicability.
  • To achieve constant-time overhead per operation while maintaining bounded space and using only single-word atomic operations (CAS, read, write).
  • To evaluate the performance of the proposed interface in real-world workloads, particularly under high contention and varying store frequencies.

Proposed method

  • The paper introduces the acquire-retire interface with four primitives: acquire (to safely read a resource handle), release (to release protection), retire (to mark a resource as obsolete), and eject (to safely destroy it after all readers have finished).
  • The method uses local hash tables per thread to manage retire-eject pairs, enabling expected constant-time operations despite potential contention.
  • It employs a fast-path/slow-path optimization in the acquire operation, initially attempting a lock-free version before falling back to a wait-free variant.
  • The weak_atomic template is introduced to wrap any type with copy and destructor semantics, enabling safe concurrent reference counting for arbitrary types.
  • The approach is implemented in C++ using atomic primitives and evaluated against standard implementations like std::shared_ptr and just::thread’s atomic_shared_ptr.
  • The system ensures linearizability, meaning all operations appear atomic, and supports multiple concurrent retire-eject pairs on the same resource.

Experimental results

Research questions

  • RQ1Can a concurrent resource management system achieve expected constant-time overhead for both access and destruction operations without relying on locks?
  • RQ2How does the proposed acquire-retire interface compare to existing lock-free techniques like hazard pointers and RCU in terms of performance and space efficiency?
  • RQ3Can the interface support multiple retire operations on the same resource, enabling efficient reference counting and object ownership transfer?
  • RQ4What is the performance scaling behavior of the interface under high-contention workloads with frequent stores and shared pointer updates?
  • RQ5To what extent can the interface be generalized to support arbitrary types with copy and destructor semantics beyond just memory blocks?

Key findings

  • The proposed acquire-retire interface achieves expected O(1) time complexity for all operations, including acquire, release, retire, and eject, under the given assumptions.
  • In low-contention workloads (N=10M), both implementations—Weak Atomic std::shared_ptr and Weak Atomic Custom shared_ptr—achieved nearly perfect scaling, with speedups of 30–31x on 32 cores.
  • In high-contention workloads (N=10), the implementations still demonstrated modest but consistent scaling, outperforming the GNU C++ library’s lock-based implementation and the just::thread lock-free implementation in terms of single-core performance and throughput.
  • The just::thread library showed superior performance in low-contention, load-heavy scenarios but suffered from over 8x slower single-core performance compared to the proposed method in store-heavy workloads.
  • The GNU C++ library’s implementation achieved only a 3x speedup on 32 cores due to global lock contention, despite having similar single-core performance to the proposed method.
  • The weak_atomic abstraction enabled a clean, reusable implementation of concurrent reference counting that supports arbitrary types with copy and destructor semantics, demonstrating the framework’s generality and practicality.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.