Lock-Free Programming: From Primitives to Working Structures

Working with multiple threads is one of the most complex problems we may encounter in our daily work. When put against the wall of multithreading, most people right away reach out for blocking approaches. In Java, it takes the form of the synchronized keyword, or some other less painful mechanisms, like ReentrantLock. Locks are not the only option: Lock-free programming is also the way.

In this text, I will show problems, techniques, and best practices related to Lock-Free Programming. I will also provide a real-life example of how to implement a Lock-Free stack. Besides, I will share common patterns on moving from Lock-Free to Wait-Free.

This article has been indexed from DZone Security Zone

Read the original article: