We study the problem of constructing concurrent objects in a setting where $P$ processes run in parallel and interact through a shared memory that is subject to write contention. Our goal is to transform hardware primitives that are subject to write contention into ones that handle contention gracefully. We give contention-resolution algorithms for several basic primitives, and analyze them under a relaxed, roughly-synchronous stochastic scheduler, where processes run at roughly the same rate up to a constant factor with high probability. Specifically, we construct read/write registers and CAS registers that have latency $O(\log P)$ w.h.p. under our scheduler model, using $O(1)$ hardware read/write registers and, in the case of our CAS construction, one hardware CAS register. Our algorithms guarantee performance even when their operations are invoked by an adaptive adversary that is able to see the entire history of operations so far, including their timing and return values. This allows them to be used as building blocks inside larger programs; using this compositionality property, we obtain several other constructions (LL/SC, fetch-and-increment, bounded max registers, and counters). To complement our constructions, we give a trade-off showing that even under a perfectly synchronous schedule and even if each process only executes one operation, any algorithm that implements any of the primitives that we consider, uses space $M$, and has latency at most $L$ with high probability must have expected latency at least $Ω(\log_{ML} P)$.
翻译:我们研究在 $P$ 个进程并行运行并通过存在写竞争的共享内存进行交互的环境中构建并发对象的问题。我们的目标是将受写竞争影响的硬件原语转化为能优雅处理竞争的原语。我们针对几种基本原语给出了竞争解决算法,并在一种松弛的、近似同步的随机调度器下进行分析,在该调度器下,进程以大致相同的速率运行(相差常数因子以内)且具有高概率。具体而言,我们构建了读/写寄存器和CAS寄存器,在我们的调度器模型下,其延迟以高概率为 $O(\log P)$,且仅使用 $O(1)$ 个硬件读/写寄存器,而在我们的CAS构造中,还使用了一个硬件CAS寄存器。即使这些操作被一个能够看到迄今为止操作全部历史(包括其时序和返回值)的自适应对手所调用,我们的算法也能保证性能。这使得它们能够用作更大程序内部的构建模块;利用这种组合性质,我们获得了其他几种构造(LL/SC、取并递增、有界最大寄存器和计数器)。为补充我们的构造,我们给出一个权衡:即使在完全同步的调度下,并且即使每个进程仅执行一个操作,任何实现我们所考虑的任意原语的算法,若使用空间 $M$ 且延迟以高概率至多为 $L$,则其期望延迟至少为 $Ω(\log_{ML} P)$。