A Concurrency Semantics for Relaxed Atomics that Permits Optimisation and Avoids Thin-Air Executions

被引:46
作者
Pichon-Pharabod, Jean [1 ]
Sewell, Peter [1 ]
机构
[1] Univ Cambridge, Cambridge CB2 1TN, England
基金
英国工程与自然科学研究理事会;
关键词
Concurrency; Relaxed memory models; C/C plus;
D O I
10.1145/2914770.2837616
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Despite much research on concurrent programming languages, especially for Java and C/C++, we still do not have a satisfactory definition of their semantics, one that admits all common optimisations without also admitting undesired behaviour. Especially problematic are the "thin-air" examples involving high-performance concurrent accesses, such as C/C++11 relaxed atomics. The C/C++11 model is in a per-candidate-execution style, and previous work has identified a tension between that and the fact that compiler optimisations do not operate over single candidate executions in isolation; rather, they operate over syntactic representations that represent all executions. In this paper we propose a novel approach that circumvents this difficulty. We define a concurrency semantics for a core calculus, including relaxed-atomic and non-atomic accesses, and locks, that admits a wide range of optimisation while still forbidding the classic thin-air examples. It also addresses other problems relating to undefined behaviour. The basic idea is to use an event-structure representation of the current state of each thread, capturing all of its potential executions, and to permit interleaving of execution and transformation steps over that to reflect optimisation (possibly dynamic) of the code. These are combined with a non-multi-copy-atomic storage subsystem, to reflect common hardware behaviour. The semantics is defined in a mechanised and executable form, and designed to be implementable above current relaxed hardware and strong enough to support the programming idioms that C/C++11 does for this fragment. It offers a potential way forward for concurrent programming language semantics, beyond the current C/C++11 and Java models.
引用
收藏
页码:622 / 633
页数:12
相关论文
共 30 条
[1]  
[Anonymous], 2011, PLDI
[2]  
Bastien J. F., 2015, N4455 NO SANE COMPIL
[3]  
Batty M., 2015, ESOP
[4]  
Batty M., 2011, POPL
[5]  
Batty M., 2013, POPL
[6]  
Batty Mark., 2012, POPL
[7]  
Becker P., 2011, 148822011 ISOIEC
[8]  
Boehm H.J., 2008, PLDI
[9]  
Boehm H.-J., 2014, P MSPC
[10]  
Boudol G., 2010, ESOP