Summary
This chapter opened with the topic of Concurrency patterns by exploring five different patterns related to managing access to shared data from multiple threads.
We learned that the lock pattern ensures that two threads are not trying to modify shared data or an object at the same time. It is also useful when one thread is reading from a shared object while another wants to modify it. We explored three different implementations of this pattern and compared their advantages and disadvantages.
We also learned that the lock pattern can be improved by introducing lock striping—a pattern that further fragments data inside one object and protects it with multiple locks instead of one. This approach is useful when we manipulate data in a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access