Notes on Lock Free Programming
I don&#x27;t like usage of the term &quot;lock free&quot; to mean &quot;locks that are less costly&quot;.<p>There&#x27;s a difference between (A) locking (waiting, really) on access to a critical section (where you spinlock, yield your thread, etc.) and (B) locking the processor to safely execute a synchronization primitive (mutexes&#x2F;semaphores).<p>CAS is &quot;lock free&quot; only in the sense that it doesn&#x27;t require the processor to stop the world in order to flip the mutex boolean.  It&#x27;s still a mutex, and it still gates access to a critical section, and you still need some kind of strategy to deal with waiting for the critical section to become available (e.g., spinlocking, signaling the OS to sleep thread execution).<p><pre><code>  An example of operation using coarse locks would be a method in Java with “synchronized” keyword.
  If a thread T is executing a synchronized method on a particular object,
  no other concurrent thread can invoke any other synchronized method on the same object.
</code></pre>
That&#x27;s just putting one giant mutex around all access to the object.  Having finer granularity != &quot;lockless&quot;.