My question is related to multithreading lock-free synchronization. I wanted to know the following:
What are general approaches to achieve this? I read somewhere about LockFreePrimitives like CompareAndExchange (CAS) or DoubleCompareAndExchange (DCA) but no explanation for those were given? Any approaches to MINIMIZE use of locks?
How does Java/.NET achieve their concurrent containers? Do they use locks or lock-free synch?
Thanks in advance.
volatile
doesn't do what you expect it to do. It may prevent the compiler from doing some optimizations, but doesn't prevent the processor from reordering reads, and therefore can't replace a barrier. – Concentre