Introduction to concurrency
So, what is concurrency and how does it relate to parallelism in the context of C# and .NET? The terms are frequently used interchangeably, and if you think about it, they do have similar meanings. When multiple threads are executing in parallel, they are running concurrently. In this book, we will use the term concurrency when discussing patterns to follow when designing for managed threading. Additionally, we will discuss concurrency in the context of the concurrent collections that were introduced to .NET developers in .NET Framework 4.0. Let’s start by learning about the concurrent collections in the System.Collections.Concurrent
namespace.
.NET has several collections that have been created with thread safety built-in. These collections can all be found in the System.Collections.Concurrent
namespace. In this section, we will introduce five of the collections. The remaining three are variations of Partitioner
. These will be explored in Chapter...