The Java memory model

The Java memory model
复制标题

DOI:
10.1145/1047659.1040336
复制
发表时间:
2005-01-01
影响因子:
--
通讯作者:
Adve, SV
Adve, SV
中科院分区:
其他
文献类型:
--
作者:
Manson, J;Pugh, W;Adve, SV

文献摘要

被引文献

相似文献

本文描述了新的Java内存模型,该模型已被修订为Java 5.0的一部分。该模型指定了多线程程序的法律行为;它定义了多线程Java程序的语义,并部分确定了Java虚拟机和编译器的法律实现。新的Java模型为正确同步程序提供了一个简单的接口 - 它可以保证与无数据标准程序的顺序一致性。它的新颖贡献是要求错误同步程序的行为受到因果关系的明确概念的界定。因果关系的要求足以尊重Java的安全性和安全性,并且较弱,以允许标准编译器和硬件优化。据我们所知,其他模型要么太弱,因为它们不能提供足够的安全/安全性,或者太强大了,因为它们依赖于排除某些标准编译器转换的数据和控制依赖的强烈概念。尽管大多数是什么当前在编译器中完成的是合法的,新模型引入了重大差异,并清楚地定义了法律转型的界限。例如,对控制依赖的普遍接受定义对于Java来说是不正确的,基于它的转换可能是无效的。在为Java提供官方的内存模型外,我们认为此处描述的模型可能被证明是其他有用的基础目前缺乏定义明确的模型的编程语言,例如C ++和C#。
This paper describes the new Java memory model, which has been revised as part of Java 5.0. The model specifies the legal behaviors for a multithreaded program; it defines the semantics of multithreaded Java programs and partially determines legal implementations of Java virtual machines and compilers.The new Java model provides a simple interface for correctly synchronized programs - it guarantees sequential consistency to data-race-free programs. Its novel contribution is requiring that the behavior of incorrectly synchronized programs be bounded by a well defined notion of causality. The causality requirement is strong enough to respect the safety and security properties of Java and weak enough to allow standard compiler and hardware optimizations. To our knowledge, other models are either too weak because they do not provide for sufficient safety/security, or are too strong because they rely on a strong notion of data and control dependences that precludes some standard compiler transformations.Although the majority of what is currently done in compilers is legal, the new model introduces significant differences, and clearly defines the boundaries of legal transformations. For example, the commonly accepted definition for control dependence is incorrect for Java, and transformations based on it may be invalid.In addition to providing the official memory model for Java, we believe the model described here could prove to be a useful basis for other programming languages that currently lack well-defined models, such as C++ and C#.