(1)说“之前订购”的真正含义是什么?因为即使action_a发生在action_b之前,action_a也可以在action_b之后的某些实现中执行,对吧?
(2)如果action_a发生在action_b之前,是否意味着action_a绝不能看到action_b?或者action_a可能会看到或看不到action_b?
(3)如果action_a没有发生 – 在action_b之前,而action_b没有发生 – 在action_a之前,是否意味着action_a可能会看到或看不到action_b?
(4)之前没有任何循环发生,对吧?
任何答案将不胜感激:)
解决方法
(1) What does it really mean by saying “ordered before”? Because even if action_a happens-before action_b,action_a can be executed after action_b in some implementation,right?
发生之前是因果关系,而不是时间关系. action_a在action_b之前进行因果排序,无论它是否在它之前实际执行.然而,在实践中,运行时很难在没有时间顺序的情况下保持因果关系.查看my earlier question,其中详细介绍了因果关系的主题.
(2) If action_a happens-before action_b,does it mean action_a MUST NOT see action_b? Or action_a may see or may not see action_b?
行动对另一方的可见性有一个明确的整体顺序.这由指定格式良好的执行的部分处理.因此,对于任何两个动作a和b,a对b可见,或b对a可见,或者上述都不可见.理解精心构造的执行概念的良好读物是Java Memory Model Examples: Good,Bad,and Ugly.
(3) If action_a does NOT happen-before action_b,and action_b does NOT happen-before action_a,does it mean action_a may see or may not see action_b?
是的,两者都有可能.无论如何都无法保证.
(4) There could not be any cyclic happens-before,right?
Happens-before必须强加部分排序,而排序的关键属性是无循环.