[concurrency-interest] Volatile happens before question
raphfrk at gmail.com
Wed Jan 18 05:42:19 EST 2012
Thanks all, for the info.
So, for a cache, if there is a write to a volatile variable, the only
requirement is that you flush the volatile to main memory last.
So, if the core writes
A) writes before volatile write
B) write to volatile
C) writes after volatile write
Then the cache can be flushed in the order A and then C and then B?
So, a core could wait before writing a volatile to main memory, until
a second write to that cache slot forces a flush (and writing a second
value to the volatile itself doesn't force a flush)?
Similarly for a read, reading from a volatile doesn't actually require
invaliding the read cache. However, if the volatile is not in the
cache, then the read cache must be flushed before reading the volatile
from main memory?
On Tue, Jan 17, 2012 at 11:45 PM, Vitaly Davidovich <vitalyd at gmail.com> wrote:
> That's true, you're right - I didn't think of that as it does seem silly but
> is allowed.
More information about the Concurrency-interest