`

Happens-before order

阅读更多

17.4.5 Happens-before Order

Two actions can be ordered by a happens-before relationship. If one action happens-before another, then the first is visible to and ordered before the second.

If we have two actions x and y , we write hb (x , y ) to indicate that x happens-before y .

 

  • If x and y are actions of the same thread and x comes before y in program order, then hb (x , y ).
  • There is a happens-before edge from the end of a constructor of an object to the start of a finalizer (§12.6) for that object.
  • If an action x synchronizes-with a following action y , then we also have hb (x , y ).
  • If hb (x , y ) and hb (y , z ), then hb (x , z ).

It should be noted that the presence of a happens-before relationship between two actions does not necessarily imply that they have to take place in that order in an implementation. If the reordering produces results consistent with a legal execution, it is not illegal.

 

最后是说有happens-before关系的两个action在实现中未必会按照那样发生,因为之前可能还存在合法的变序操作

 

http://java.sun.com/docs/books/jls/third_edition/html/memory.html

分享到:
评论

相关推荐

    深入理解Java内存模型??总结

    如果一个操作happens-before另一个操作,那么第一个操作的结果对第二个操作必须是可见的,并且第一个操作的执行顺序在程序逻辑上被认为是在第二个操作之前。通过happens-before原则,JMM保证了线程间的通信行为。 ...

    C++多线程编程介绍,技巧及注意要点--Part2.pptx

    三种关系包括:先发生(happens-before)、后发生(happens-after)和无序(unordered)。六种内存顺序则分为从弱到强的六个级别:无序(unordered)、松散(relaxed)、释放(release)、获取(acquire)、获取-...

    Senfore_DragDrop_v4.1

    The demos should be run in the order in which they are listed in the supplied project group. Even if you have used previous versions of the Drag and Drop Component Suite it would be a good idea to ...

    win 3.11 for workgroup tcpip支持

    If this happens do the following: 1) Remove any previous versions of Microsoft TCP/IP-32. 2) Exit Network Setup and restart your system. 3) Rename any OEMx.INF (where x is any number) files that are ...

    C++ Concurrency in Action 2012.03

    - 记载顺序(happens-before)关系,用来表示不同线程操作之间的顺序关系。 ##### 5.2 原子类型操作 - 原子类型的使用不仅限于简单的整型数据,还包括指针类型和其他复杂类型。 - 原子操作可以通过设置不同的内存序...

    php.ini-development

    (excluding headers and cookies) PHP should keep internally before pushing that ; data to the client. If your application's output exceeds this setting, PHP ; will send that data in chunks of roughly ...

    冲突规则

    3. **先行发生关系(Happens-Before)**:这是Java内存模型中的一个概念,用于定义操作间的顺序,以防止并发编程中的数据竞争。如果一个操作先行发生于另一个操作,那么第二个操作不能看到第一个操作前的状态。 4. ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    (flex-property value) before saving in the filer. - ADD: In the class TFlexGrid added the methods DoSnap and DoCustomSnap (the last one can be overridden for the implementation of new alignment ...

    一个跨平台的CString源码

    // Anyway, these people are (in chronological order): // // - Pete the Plumber (???) // - Julian Selman // - Chris (of Melbsys) // - Dave Plummer // - John C Sipos // - Chris Sells // -...

    a project model for the FreeBSD Project.7z

    A project model for the FreeBSD Project Niklas Saers ... ...Table of Contents Foreword 1 Overview 2 Definitions ...3-1....3-2....4-1....4-2....4-3....5-1....6-1....6-2....6-3....6-4....6-5....6-6....6-7....6-8....6-9....8-1....Up until now, the FreeBSD ...

    计算机网络第六版答案

    Since the available bandwidth of the shared link is 2Mbps, there will be no queuing delay before the link. Whereas, if three users transmit simultaneously, the bandwidth required will be 3Mbps ...

    微软内部资料-SQL性能优化3

    For example, a second transaction traversing the doubly linked list mentioned above would see the list before or after the insert, but it will see only complete changes. Durability After a ...

    Cracking The Coding Interview 5th Ed (高清版上卷)

    In order to ace the interview, you first need to get an interview. This section describes what a software engineer's resume should look like and what you should be doing well before your interview. ...

    Cracking The Coding Interview 5th Ed (高清版下卷)

    In order to ace the interview, you first need to get an interview. This section describes what a software engineer's resume should look like and what you should be doing well before your interview. ...

    Sybex - Mastering Visual Basic .NET (VBL).pdf

    before you could start using the language. Being able to access the Framework’s objects means that you’re no longer limited by the language. The new version of the language unlocks the full ...

    Delphi7.1 Update

    This happens if you populate the Nested Dataset field before populating another field that precedes it in the field order. * The TClientDataSet.ApplyUpdates method fails if the dataset contains only ...

    Using LUA with Visual C++ (Introduction)

    You can also define LUA_API before including lua.h : #define LUA_API extern "C" #include <lua.h> I recommend that you use the first method. The LUA State In order to use LUA you have to ...

    go系统编程(英文版)

    see what happens behind the scenes when you execute a program. Lastly, it talks about how you can use the go tool to detect unreachable code and how to avoid some common Go mistakes. Chapter 4, Go ...

    C# Game Programming Cookbook for Unity 3D - 2014

    Acknowledgments xiii Introduction xv 1. Making Games the Modular Way 1 1.1 Important Programming Concepts.....................................2 1.1.1 Manager and Controller Scripts.......................

Global site tag (gtag.js) - Google Analytics