Chapter 19

Parallel Programming Using Tasks and Threads

What's in this chapter?

Understanding the task-based programming model, the Task Parallel Library, and its related hardware technologies

Launching, controlling, managing, and synchronizing parallel tasks

Refactoring loops to run them in parallel using Parallel.For and Parallel.ForEach

Transforming existing sequential code into parallelized code

Measuring the speed gain and the scalability offered by parallelized code

Working with different degrees of parallelism

Understanding the advantages of working with concurrent collections

Implementing a simple parallel producer-consumer pattern

Parallelizing LINQ queries using PLINQ

Wrox.com Code Downloads For This Chapter

The wrox.com code downloads for this chapter are found at www.wrox.com/remtitle.cgi?isbn=9781118314456 on the Download Code tab. The code is in the chapter 19 download and individually named according to the code file names listed throughout the chapter.

In the last few years, multicore technology has become the mainstream in CPU designs, and microprocessor manufacturers continue to improve their processing power. However, the shift to multicore is an inflexion point for software design philosophy.

This chapter is about the lightweight concurrency model introduced by Visual Basic 2010 with .NET Framework 4 and extended in Visual Basic 2012 with .NET Framework 4.5. A comprehensive treatment of the challenges offered by the new multicore designs could easily fill 600 ...

Get Professional Visual Basic 2012 and .NET 4.5 Programming 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.