Copyright by Gastón C. Hillar

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 4. Concurrent Collections

WHAT'S IN THIS CHAPTER?

  • Understanding the features offered by concurrent collections

  • Working with the concurrent collections found in the new System.Collection.Concurrent namespace

  • Working with concurrent queues

  • Implementing a parallel producer-consumer pattern

  • Working with multiple producers and consumers

  • Designing pipelines by using concurrent collections

  • Working with concurrent stacks

  • Transforming arrays and unsafe collections into concurrent collections

  • Working with concurrent bags

  • Understanding the IProducerConsumerCollection interface

  • Understanding bounding and blocking capabilities offered by blocking concurrent collections

  • Cancelling operations on concurrent collections

  • Implementing a filtering pipeline with many BlockingCollection instances

Task-based programming, imperative data, and task parallelism require arrays, lists, and collections capable of supporting updates concurrently. Before .NET Framework 4, it was necessary to add complex code to synchronize the operations performed in shared arrays, lists, and collections when they were updated by multiple threads. Now, you can work with the new concurrent collections to simplify the code and to achieve the best performance. These collections allow you to solve complex algorithms with simpler code. However, because they were just introduced with .NET Framework 4, you need to learn five new classes and one new interface.

This chapter is about the new classes and the new interface that allow you to work ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required