Chapter 6. PLINQ: Declarative Data Parallelism

WHAT'S IN THIS CHAPTER?

  • Transforming LINQ into parallelized LINQ

  • Understanding partitioning in PLINQ

  • Performing reduction operations with PLINQ

  • Creating custom PLINQ aggregate functions

  • Working with concurrent PLINQ tasks

  • Cancelling PLINQ and measuring its scalability

  • Specifying the desired degree of parallelism

  • Working with ForAll and understanding how it differs from foreach

  • Configuring how PLINQ results are returned by using WithMergeOptions

  • Handling exceptions thrown by PLINQ

  • Using PLINQ to execute Map Reduce algorithms

This chapter explains how to work with declarative data parallelism and a mix of task and data decomposition using Parallel Language Integrated Query (PLINQ). It is very important to understand all the things explained in the previous chapters before reading this one, because this chapter combines many of the topics studied before.

This chapter explains how to transform a LINQ query into a PLINQ query and the different techniques to tune its parallel execution according to different scenarios. In addition, it explains the execution of the classic parallel Map Reduce algorithms using PLINQ and its aggregate functions. Sometimes, PLINQ doesn't offer the results that developers expected. Therefore, it is also important to understand the potential performance bottlenecks and the different ways to solve them.

TRANSFORMING LINQ INTO PLINQ

You already know that Language Integrated Query (LINQ) is very useful to query and process different ...

Get Professional Parallel Programming with C#: Master Parallel Extensions With .NET 4 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.