Java内存模型
Java内存模型(中文6000字,英文3000字)
抽象
本文描述了新的Java内存模型,其中已被修改为Java 5.0的一部分。该模型指定多线程程的法律行为;它定义多线程Java程序的语义和部分确定Java虚拟机的合法实现和编译器。新的Java模型为正确提供了一个简单的界面同步程序 - 它保证了顺序一致性到无数据竞争的节目。其新颖的贡献程序受到明确的因果关系概念的限制。因果关系的要求足够强大,以尊重Java的安全和安全属性和足够弱允许标准的编译器和硬件优化。至我们的知识,其他模式要么太弱,因为他们没有提供足够的安全/保障,或者也是如此强大,因为它们依赖于强大的数据和概念控制依赖,排除一些标准的编译器转换。尽管目前大部分工作都是在编译器中完成的是合法的,新模式引入了重大差异,并明确界定了法律转型的界限。例如,普遍接受的控制定义依赖对Java不正确,并且基于转换它可能是无效的。除了提供官方的内存模型之外Java,我们相信这里描述的模型可以证明是一个目前其他编程语言的有用基础缺乏定义明确的模型,如C ++和C#。类别和主题描述符:D.3.1 [编程语言]:形式定义和理论; D.3.0[编程语言]:标准; F.3.2 [逻辑]。
The Java Memory Model∗ [资料来源:http://Doc163.com]
ABSTRACT
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 cor- rectly synchronized programs – it guarantees sequential con- sistency 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.
[来源:http://Doc163.com]
Although the majority of what is currently done in compil- ers 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#.
Categories and Subject Descriptors: D.3.1 [Program- ming Languages]: Formal Definitions and Theory; D.3.0 [Programming Languages]: Standards; F.3.2 [Logics
[资料来源:https://www.doc163.com]