3

Is there a difference in timing of memory caches coherency (or "flushing") after Interlocked operations and after invoking Memory barriers? Let's consider in C# - using any Interlocked operations vs Thread.MemoryBarrier() - is the resulting memory caches refresh behavior identical or not?

I believe there is a difference. I was solving one business case that seemed to be caused by delayed flush after memory barrier (we replaced with Interlocked operation). Also there is quite a few information sources (including wikipedia) suggesting that memory barriers doesn't guarantee timing of operations.

I can link more references or add example code snippet if interested, but initially I want to keep the question short (as I was down-voted for too much info in my original question to this topic)

Community
  • 1
  • 1
Jan
  • 1,905
  • 17
  • 41

1 Answers1

0

As answered also in the original question: CAS (Interlocked) operations have been (and most likely will be) the quickest caches flusher.

Community
  • 1
  • 1
Jan
  • 1,905
  • 17
  • 41