Thread-Safe Collection Types
Even though we cover threading, synchronization, and related concepts in Chapters 29 through 31, this chapter is a good place to say a few things about thread safe use of collection types.
Multithreaded programming is becoming more and more important today, thanks to the introduction of processors with many cores. To speed up computation and harness the power of today’s hardware, you usually use threads to attempt to run different parts of a program in parallel. I’m explicitly saying attempt because a lot of factors may cause sequential execution, including the operating system’s scheduler behavior, blocking and locking, and so on.
Instead of digressing much further about the virtues and complexities of multithreaded ...
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