Java Multithreading, Concurrency, and Parallelism — Part 17.2
Introduction to non-blocking — Compare and Swap
We have seen the
CopyOnWriteArrayList in the previous part. In this part, we will look at
ConcurrentHashMap which is yet another beast in terms of understanding what is happening behind the scenes. But before that, we need to understand what CAS(Compare-And-Swap) is. We will dedicate this article solely to CASing. In the next part, we will have an in-depth understanding of
putVal() method which is commonly used by all the
putAll and etc.