Laws of Order: Expensive Synchronization in Concurrent Algorithms Cannot be Eliminated

被引:34
作者
Attiya, Hagit [1 ]
Guerraoui, Rachid [1 ]
Hendler, Danny [1 ]
Kuznetsov, Petr [1 ]
Michael, Maged M. [1 ]
Vechev, Martin [1 ]
机构
[1] Technion Israel Inst Technol, IL-32000 Haifa, Israel
来源
POPL 11: PROCEEDINGS OF THE 38TH ANNUAL ACM SIGPLAN-SIGACT SYMPOSIUM ON PRINCIPLES OF PROGRAMMING LANGUAGES | 2011年
关键词
Concurrency; Algorithms; Lower Bounds; Memory Fences; Memory Barriers; SHARED-MEMORY; BOUNDS;
D O I
10.1145/1926385.1926442
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Building correct and efficient concurrent algorithms is known to be a difficult problem of fundamental importance. To achieve efficiency, designers try to remove unnecessary and costly synchronization. However, not only is this manual trial-and-error process ad-hoc, time consuming and error-prone, but it often leaves designers pondering the question of: is it inherently impossible to eliminate certain synchronization, or is it that I was unable to eliminate it on this attempt: and I should keep trying? In this paper we respond to this question. We prove that it is impossible to build concurrent implementations of classic and ubiquitous specifications such as sets, queues, stacks, mutual exclusion and read-modify-write operations, that completely eliminate the use of expensive synchronization. We prove that one cannot avoid the use of either: i) read-after-write (RAW), where a write to shared variable A is followed by a read to a different shared variable B without a write to B in between, or ii) atomic write-after-read (AWAR), where an atomic operation reads and then writes to shared locations. Unfortunately, enforcing RAW or AWAR is expensive on all current mainstream processors. To enforce RAW, memory ordering also called fence or barrier instructions must be used. To enforce AWAR, atomic instructions such as compare -and-swap are required. However, these instructions are typically substantially slower than regular instructions. Although algorithm designers frequently struggle to avoid RAW and AWAR, their attempts are often futile. Our result characterizes the cases where avoiding RAW and AWAR is impossible. On the flip side, our result can be used to guide designers towards new algorithms where RAW and AWAR can be eliminated.
引用
收藏
页码:487 / 498
页数:12
相关论文
共 45 条
[1]   Shared memory consistency models: A tutorial [J].
Adve, SV ;
Gharachorloo, K .
COMPUTER, 1996, 29 (12) :66-&
[2]  
Anderson T. E., 1990, IEEE Transactions on Parallel and Distributed Systems, V1, P6, DOI 10.1109/71.80120
[3]  
[Anonymous], 2008, ART MULTIPROCESSOR P
[4]  
ARORA NS, 1998, P 10 ANN ACM S PAR A, P119, DOI DOI 10.1145/277651.277678
[5]   Computing in totally anonymous asynchronous shared memory systems [J].
Attiya, H ;
Gorbach, A ;
Moran, S .
INFORMATION AND COMPUTATION, 2002, 173 (02) :162-183
[6]  
ATTIYA H, 2004, P 23 ANN ACM S PRINC, P60
[7]  
BARDAVID Y, 2003, P 17 INT C DISTR COM, P136
[8]   Reordering Constraints for Pthread-Style Locks [J].
Boehm, Hans-J. .
PROCEEDINGS OF THE 2007 ACM SIGPLAN SYMPOSIUM ON PRINCIPLES AND PRACTICE OF PARALLEL PROGRAMMING PPOPP'07, 2007, :173-182
[9]   Line-Up: A Complete and Automatic Linearizability Checker [J].
Burckhardt, Sebastian ;
Dern, Chris ;
Musuvathi, Madanlal ;
Tan, Roy .
PLDI '10: PROCEEDINGS OF THE 2010 ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION, 2010, :330-340
[10]   BOUNDS ON SHARED-MEMORY FOR MUTUAL EXCLUSION [J].
BURNS, JE ;
LYNCH, NA .
INFORMATION AND COMPUTATION, 1993, 107 (02) :171-184