Please wait a minute...
Frontiers of Computer Science

ISSN 2095-2228

ISSN 2095-2236(Online)

CN 10-1014/TP

邮发代号 80-970

2019 Impact Factor: 1.275

Frontiers of Computer Science  2016, Vol. 10 Issue (1): 54-81   https://doi.org/10.1007/s11704-015-4492-4
  本期目录
An operational happens-before memory model
Yang ZHANG1,2,*(),Xinyu FENG1,2,*()
1. School of Computer Science and Technology, University of Science and Technology of China, Hefei 230026, China
2. Suzhou Institute for Advanced Study, University of Science and Technology of China, Suzhou 215123, China
 全文: PDF(1506 KB)  
Abstract

Happens-before memory model (HMM) is used as the basis of Java memory model (JMM). Although HMM itself is simple, some complex axioms have to be introduced in JMM to prevent the causality loop, which causes absurd out-of-thin-air reads that may break the type safety and security guarantee of Java. The resulting JMM is complex and difficult to understand. It also has many anti-intuitive behaviors, as demonstrated by the “ugly examples” by Aspinall and Ševˇcík [1]. Furthermore, HMM (and JMM) specifies only what execution traces are acceptable, but says nothing about how these traces are generated. This gap makes it difficult for static reasoning about programs.

In this paper we present OHMM, an operational variation of HMM. The model is specified by giving an operational semantics to a language running on an abstract machine designed to simulate HMM. Thanks to its generative nature, the model naturally prevents out-of-thin-air reads. On the other hand, it uses a novel replay mechanism to allow instructions to be executed multiple times, which can be used to modelmany useful speculations and optimization. The model is weaker than JMM for lockless programs, thus can accommodate more optimization, such as the reordering of independent memory accesses that is not valid in JMM. Program behaviors are more natural in this model than in JMM, and many of the anti-intuitive examples in JMM are no longer valid here. We hope OHMM can serve as the basis for new memory models for Java-like languages.

Key wordsrelaxed memory model    happens-before    operatonal semantics    DRF-Guarantee    JMM
收稿日期: 2014-11-02      出版日期: 2016-01-06
Corresponding Author(s): Yang ZHANG,Xinyu FENG   
 引用本文:   
. [J]. Frontiers of Computer Science, 2016, 10(1): 54-81.
Yang ZHANG,Xinyu FENG. An operational happens-before memory model. Front. Comput. Sci., 2016, 10(1): 54-81.
 链接本文:  
https://academic.hep.com.cn/fcs/CN/10.1007/s11704-015-4492-4
https://academic.hep.com.cn/fcs/CN/Y2016/V10/I1/54
1 Aspinall D, Ševˇcík J. Java memory model examples: good, bad and ugly. In: Proceedings of Verification and Analysis of Multi-threaded Java-like Programs. 2007, 66–80
2 Lamport L. How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Transactions on Computers, 1979, 28(9): 690–691
https://doi.org/10.1109/TC.1979.1675439
3 Boehm H J. Threads cannot be implemented as a library. In: Proceedings of Programming Language Design and Implementation. 2005, 261–268
https://doi.org/10.1145/1065010.1065042
4 Adve S V, Gharachorloo K. Shared memory consistency models: a tutorial. IEEE Transactions on Computers, 1996, 29(12): 66–76
https://doi.org/10.1109/2.546611
5 Manson J, Pugh W, Adve S V. The Java memory model. In: Proceedings of the 32nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 2005, 378–391
https://doi.org/10.1145/1040305.1040336
6 Cenciarelli P, Knapp A, Sibilio E. The Java memory model: operationally, denotationally, axiomatically. In: Proceedings of the 16th European Symposium on Programming. 2007, 331–346
https://doi.org/10.1007/978-3-540-71316-6_23
7 Zhang Y, Feng X. An operational approach to happens-before memory model. In: Proceedings of the 7th International Symposium on Theoretical Aspects of Software Engineering. 2013, 121–128
https://doi.org/10.1109/tase.2013.24
8 Lamport L. Time, clocks, and the ordering of events in a distributed system. Communications of the ACM, 1978, 21(7): 558–565
https://doi.org/10.1145/359545.359563
9 Aspinall D, Ševˇcík J. Formalising Java’s data race free guarantee. In: Proceedings of Theorem Proving in Higher Order Logics. 2007, 22–37
https://doi.org/10.1007/978-3-540-74591-4_4
10 Huisman M, Petri G. The Java memory model: a formal explanation. In: Proceedings of Verification and Analysis of Multi-threaded Javalike Programs. 2007, 81–96
11 Manson J. The Java Memory Model. Dissertation for the Doctoral Degree. College Park: University of Maryland, 2004
12 Ševˇcík J, Aspinall D. On validity of program transformations in the Java memory model. In: Proceedings of the 22nd European Conference on Object-Oriented Programming. 2008, 27–51
13 Vafeiadis V, Balabonski T, Chakraborty S, Morisset R, Nardelli F Z. Common compiler optimisations are invalid in the C11 memory model and what we can do about it. In: Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 2015, 209–220
https://doi.org/10.1145/2676726.2676995
14 Yang Y, Gopalakrishnan G, Lindstrom G. Specifying Java thread semantics using a uniform memory model. In: Proceedings of Joint ACM Java Grande- ISCOPE 2002 Conference. 2002, 192–201
https://doi.org/10.1145/583810.583832
15 Lochbihler A. Java and the Java memory model- a unified, machinechecked formalisation. In: Proceedings of the 21st European Symposium on Programming. 2012, 497–517
16 Saraswat V A, Jagadeesan R, Michael M M, Praun V C. A theory of memory models. In: Proceedings of the 12th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. 2007, 161–172
https://doi.org/10.1145/1229428.1229469
17 Jagadeesan R, Pitcher C, Riely J. Generative operational semantics for relaxed memory models. In: Proceedings of the 19th European Symposium on Programming. 2010, 307–326
https://doi.org/10.1007/978-3-642-11957-6_17
18 Sarkar S, Sewell P, Alglave J, Maranget L,Williams D. Understanding power multiprocessors. In: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation. 2011, 175–186
https://doi.org/10.1145/1993498.1993520
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed