(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必须强加部分排序,而排序的关键属性是无循环.