待ちフリー定数時間における並列参照カウントとリソース管理
Concurrent Reference Counting and Resource Management in Wait-free Constant Time
Concurrent Reference Counting and Resource Management in Wait-free Constant Time
@misc{blelloch2020concurrent,
title = {Concurrent Reference Counting and Resource Management in Wait-free Constant Time},
author = {Guy E. Blelloch and Yuanhao Wei},
year = {2020},
eprint = {2002.07053},
archivePrefix = {arXiv},
primaryClass = {cs.DC},
url = {https://arxiv.org/abs/2002.07053}
}
Blelloch, G. E., & Wei, Y. (2020). Concurrent Reference Counting and Resource Management in Wait-free Constant Time [Preprint]. arXiv. https://doi.org/10.48550/arXiv.2002.07053
BLELLOCH GE, WEI Y. Concurrent Reference Counting and Resource Management in Wait-free Constant Time[EB/OL]. (2020-02-17)[2026-11-29]. https://arxiv.org/abs/2002.07053.
要旨
並行プログラムを実装する際、一般的な課題として、リソース(例:メモリブロック、ファイルディスクリプタ、ネットワーク接続)を読み取りその後使用するプロセスと、同じリソースを同時に書き換えその後破壊するプロセス間の非安全な競合を効率的に保護することがある。このような読み取り破壊競合は、ロックや、ハザードポインタや読み取り複製更新(RCU)などのロックフリー解法で保護できる。本稿では、単一の単語原子メモリ操作(読み取り、書き込み、CAS)のみを用いて、期待定数時間のオーバーヘッド、O(P^2) スペース、O(P^2) 遅延破壊を伴う読み取り破壊競合を保護する方法を記述する。これは、アクセスを保護するためのアキュア - リリースペアと、破壊を安全なタイミングまで遅延させるためのレタイ - エジェクトペアからなる 4 つのプリミティブを持つインターフェースに基づいている。これをアキュア - レタイインターフェースと呼ぶ。アキュア - レタイインターフェースを用いて、3 つの一般的なユースケースに対する単純な実装を開発した:(1) スタックとキューへの応用を含むメモリ再帰収、(2) 参照カウントされたオブジェクト、(3) 所有権による管理、コピー、破壊を含むオブジェクト。最初の 2 つの結果は以前の結果を大幅に改善しており、第 3 の応用は新規である。重要なのは、すべての操作が期待定数時間のオーバーヘッドを持つことである。
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.