Chapter 6. Using Concurrent Collections

In this chapter, we will look through the different data structures for concurrent programming included in the .NET Framework base class library. You will learn the following recipes:

  • Using ConcurrentDictionary
  • Implementing asynchronous processing using ConcurrentQueue
  • Changing the asynchronous processing order with ConcurrentStack
  • Creating a scalable crawler with ConcurrentBag
  • Generalizing asynchronous processing with BlockingCollection

Introduction

Programming requires understanding and knowledge of basic data structures and algorithms. To choose the best-suited data structure for a concurrent situation, a programmer has to know about many things, such as algorithm time, space complexity, and the big O notation. ...

Get Multithreading with C# Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.