[concurrency-interest] JMM and reorderings

thurstonn thurston at nomagicsoftware.com
Mon May 5 12:59:18 EDT 2014


Given the following:

Initially, x == y == 0
Thread 1       Thread 2
r1 = x            r3 = y
y = 5             x = 5
r2 = x

Thinking about legal outcomes under the JMM:
r1 == r2 == r3 == 0 is a well-known legal outcome given allowed
reorderings/optimizations


But what about the following?
r2 == 0, r1 == 5
Which is equivalent to allowing:
r2 = x
r1 = x
y = 5

I want to say that that is a violation of intra-thread conistency guarantees
(or intra-thread semantics if you prefer), but it's not clear to me where
specifically the JMM would prohibit that.







--
View this message in context: http://jsr166-concurrency.10961.n7.nabble.com/JMM-and-reorderings-tp10973.html
Sent from the JSR166 Concurrency mailing list archive at Nabble.com.


More information about the Concurrency-interest mailing list