File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -52,3 +52,13 @@ class Node
5252 # ...
5353end
5454```
55+ ## Piggybacking
56+
57+ Any write executed before volatile write based on program-order is visible to
58+ the volatile read as well, which allows
59+ [ piggybacking] ( http://stackoverflow.com/questions/8769570/volatile-piggyback-is-this-enough-for-visiblity ) .
60+ Because it creates synchronizes-with (JMM term) order between volatile write
61+ and read, which participates in creating happens-before order.
62+
63+ This trick is used in some of the abstractions, to avoid unnecessary
64+ synchronization or volatile declarations.
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ time-consuming and error-prone.
3434The Ruby memory model is a framework allowing to reason about programs in
3535concurrent and parallel environment. It defines what variable writes can be
3636observed by a particular variable read, which is essential to be able to
37- determine if a program is correct. It is achieved be defining what subset of
37+ determine if a program is correct. It is achieved by defining what subset of
3838all possible program execution orders is allowed.
3939
4040A memory model sources:
@@ -70,14 +70,9 @@ C++11). This is not a formal model.
7070
7171Key properties are:
7272
73- - ** volatility (V)** - Any written value is immediately visible to any
74- subsequent volatile read of the same variable. Any write executed before
75- volatile write based on program-order is visible to the read as well, which
76- allows
77- [ piggybacking] ( http://stackoverflow.com/questions/8769570/volatile-piggyback-is-this-enough-for-visiblity ) .
78- (Same meaning as in Java, it creates synchronizes-with (JMM term) order
79- between write and read, which participates in creating happens-before
80- order.)
73+ - ** volatility (V)** - A written value is immediately visible to any
74+ subsequent volatile read of the same variable on any Thread. (It has same
75+ meaning as in Java.)
8176- ** atomicity (A)** - Operation is either done or not as a whole.
8277- ** serialized (S)** - Operations are serialized in some order (they
8378 cannot disappear). This is a new property not mentioned in other memory
You can’t perform that action at this time.
0 commit comments