Concurrent patterns

We have already reviewed some of these patterns earlier in this book. For example, in Chapter 4, Task Parallel Library in Depth, we studied Parallel.Invoke and Parallel.Foreach, which actually is an implementation of the fork/join pattern. In Chapter 6, Using Concurrent Data Structures, we reviewed a Producer/Consumer pattern implementation. However, there is a very important scenario that we have not seen yet. It is called a parallel pipeline.

Parallel pipelines

Usually a complex parallel computation can be considered as several stages combined into some sort of a pipeline. The latter stage needs the results of the former, and this prevents these stages from running in parallel. However, the calculations inside each stage ...

Get Mastering C# Concurrency 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.