[jmm-dev] Sequential Consistency
John Rose
john.r.rose at oracle.com
Sat Feb 22 14:55:11 PST 2014
On Feb 22, 2014, at 7:59 AM, Doug Lea <dl at cs.oswego.edu> wrote:
> IRIW conformance an unnecessary action-at-a-distance
> by-product of SC, or does it play some intrinsically useful role in
> assuring correctness
It sounds like you are asking someone to speak up for the usefulness of SC when the two bits of test state (global x, y) are at an arbitrarily large "distance".
Though I am not well-read on this stuff, I'll venture related questions that seem relevant to the JMM and that appealing idea of distance.
If x and y are related together because they represent something coherent, SC could act as a fail-safe after everybody loses track of their relation. It would be best not to lose track, though.
What are the cases where there is a sufficiently small "distance" that programmers would want SC? One example would be an actor (variables used only by one thread). Another would be an object under a mutex. Or the two variables ("globals") are not under a mutex but are in the same object (cache line?) being racily used. Or the variables are related more tenuously but all the threads agree in a single safely published access path to both.
Is there an idea of "distance" or locality for the JMM that would be useful to programmers?
Would it be useful to provide programmers SC within a singly-rooted connected subgraph of Java heap nodes? Can we define such subgraphs in a way that is not sensitive to mutations in the connecting references? Can we use ideas of reference variables which are immutable (time invariant) or have some monotonicity (set-once)?
Or does the research demonstrate IRIW-like anomalies for all sorts of "distances"?
— John
More information about the jmm-dev
mailing list