Re:Who ordered memory fences on an x86? (2008)
by DSingularity on Friday November 07, 2014 @10:18AM
(#8572853)
They are reordered, but only speculatively.
This requirement is needed for:
T1: rd y; rd x;
T2: wr y 1;Wr x 1;
If you allow reordering its possible for an execution to observe x=0 y=1 on thread one, but that's a sequential consistency violation.
Re:Who ordered memory fences on an x86? (2008)
by xxs on Friday November 07, 2014 @12:57PM
(#8573713)
Even a simple seq(alike) lock needs a load-load fence.
Without a load-load fence the verification of the condition doesn't offer any guarantees for the "previously" read data, i.e. the actual data load might be reordered past the load of seq.
Re:Who ordered memory fences on an x86? (2008)
by rayiner on Friday November 07, 2014 @12:59PM
(#8573729)
To add to the example of 'DSingularity: remember that the memory ordering guarantees specify the behavior of individual processors in a multi-processor system. You have to extrapolate the system behavior from there. The guarantee on reordering of loads with respect to each other is only unnecessary if you assume that no other processor modifies those locations between loads.
Wonder why that guarantee is necessary. Loads have no side-effects (in the memory), after all.