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 ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.