Safe Optimisations for Shared-Memory Concurrent Programs

被引:1
|
作者
Sevcik, Jaroslav [1 ]
机构
[1] Univ Cambridge, MathWorks, Cambridge CB2 1TN, England
基金
英国工程与自然科学研究理事会;
关键词
Languages; Reliability; Theory; Verification; Relaxed Memory Models; Semantics; Compiler Optimizations;
D O I
10.1145/1993316.1993534
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Current proposals for concurrent shared-memory languages, including C++ and C, provide sequential consistency only for programs without data races (the DRF guarantee). While the implications of such a contract for hardware optimisations are relatively well-understood, the correctness of compiler optimisations under the DRF guarantee is less clear, and experience with Java shows that this area is error-prone. In this paper we give a rigorous study of optimisations that involve both reordering and elimination of memory reads and writes, covering many practically important optimisations. We first define powerful classes of transformations semantically, in a language-independent trace semantics. We prove that any composition of these transformations is sound with respect to the DRF guarantee, and moreover that they provide basic security guarantees (no thin-air reads) even for programs with data races. To give a concrete example, we apply our semantic results to a simple imperative language and prove that several syntactic transformations are safe for that language. We also discuss some surprising limitations of the DRF guarantee.
引用
收藏
页码:306 / 316
页数:11
相关论文
共 50 条