By: Wilco (Wilco.Dijkstra.delete@this.ntlworld.com), July 13, 2015 4:50 pm
Room: Moderated Discussions
NoSpammer (no.delete@this.spam.com) on July 13, 2015 12:34 pm wrote:
> EduardoS (no.delete@this.spam.com) on July 12, 2015 6:47 pm wrote:
> > Good argument, everyone life's would be easier if a variable read means "get the
> > absolutely most up-to-date value of this memory location", but if it was the case
> > x86 memory ordering would also be broken too and needs a lot of barriers.
>
> With x86 a volatile variable is at least up to date monotonically with respect to what you've seen
> so far. That's actually good enough and it's excellent for producer-consumer type of stuff.
That's not even true on x86. Loads may be lifted before stores and so you may read an incorrect or "impossible" value.
Wilco
> EduardoS (no.delete@this.spam.com) on July 12, 2015 6:47 pm wrote:
> > Good argument, everyone life's would be easier if a variable read means "get the
> > absolutely most up-to-date value of this memory location", but if it was the case
> > x86 memory ordering would also be broken too and needs a lot of barriers.
>
> With x86 a volatile variable is at least up to date monotonically with respect to what you've seen
> so far. That's actually good enough and it's excellent for producer-consumer type of stuff.
That's not even true on x86. Loads may be lifted before stores and so you may read an incorrect or "impossible" value.
Wilco