How does Thread.MemoryBarrier() flush cache?

84 views Asked by At

Thread.MemoryBarrier() makes the program to fetch value from main memory instead of using registers, but if we have the following programs:

_a = xxx;
_b = xxx;
Thread.MemoryBarrier();
_c = xxx;
_d = xxx;

does all _a, _b, _c, _d value all fetched from main memory or only the wrapped variables _b and _c are fetched from main memory, or only _c and _d which after the barrier are fetched from main memory?

0

There are 0 answers