4 ms·
> Loads are not reordered with other loads. Wonder why that guarantee is necessary. Loads have no side-effects (in the memory), after all.
by amelius 12y ago
> Loads are not reordered with other loads.
Wonder why that guarantee is necessary. Loads have no side-effects (in the memory), after all.
- DSingularity 12y agoThey 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.
- xxs 12y agoEven 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.
- rayiner 12y agoTo 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.
- amelius 12y agoAh yes, I understand it now. Took me some time to get myself thinking on that abstraction level again :) Thanks!