Reputation: 1069
A program should always read back what it wrote earlier even with most relaxed consistency. Say a program was running on core1 and is moved another core2 between write and subsequent read, what are the responsibilities of OS, and memory subsystems to make sure read returns the previously written?
Upvotes: 0
Views: 179
Reputation: 44066
The OS must ensure that all the CPU state that is program visible is correctly saved and restored upon a context switch.
So in theory L1 must be flushed.
In practice however this depends on the platform, for example the x86 architecture enforce cache coherency with the MESI and as such every CPU share a coherent image of the memory in their caches and the L1 cache is not flushed.
However other types of cache must be flushed, for example the TLBs.
Upvotes: 2