21. Iterating in Parallel

In Chapter 19, we mentioned how the cost of computation is falling, resulting in computers with faster CPUs, an increased number of CPUs, and an increased number of cores in each CPU. Collectively, these trends are making it increasingly more economical to boost the execution parallelization to take advantage of the increased computing power. In this chapter, we look at executing loops in parallel, which is one of the easiest ways to take advantage of the increased computing capability. Much of the chapter consists of Beginner and Advanced Topic blocks.

A mind map depicts the various concepts of iterations in parallel. This includes the following: (1) Parallel loops, (2) Exception handling, (3) Iteration cancellation, and (4) Parallel LINQ.
Begin 4.0

Executing Loop Iterations in Parallel

Consider the ...

Get Essential C# 8.0, 7th 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.