O'Reilly logo

C# Multithreaded and Parallel Programming by Rodney Ringler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Summary

In this chapter, we covered all aspects of imperative data parallelism. In Chapter 10, Parallel LINQ – PLINQ, we will cover declarative data parallelism with PLINQ discussion. Data parallelism using TPL in .NET really comes down to performing parallel loops using the Parallel.For and Parallel.ForEach methods. These parallel loops allow us to iterate through a set or collection of data and perform the same function on each member of the set concurrently.

We learned how to perform a parallel loop on a set of data using Parallel.For and a collection of data using Parallel.ForEach. We then saw how to stop or break from a loop when a particular condition was reached; for this we used the ParallelLoopState object that .NET can generate.

Next, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required