O'Reilly logo

Professional Parallel Programming with C#: Master Parallel Extensions With .NET 4 by Gastón C. Hillar

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

Chapter 2. Imperative Data Parallelism

WHAT'S IN THIS CHAPTER?

  • Understanding pure data-parallel problems

  • Launching parallel tasks

  • Understanding the differences between parallelism and concurrency

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

  • Working with different techniques to partition input data in parallelized loops

  • Controlling parallelized loops

  • Transforming existing sequential code into parallelized code

  • Measuring the speedups and the scalability offered by parallelized code

  • Working with different degrees of parallelism

Visual C# 2010 (C# 4.0) and .NET Framework 4 offer exciting features designed to tackle the multicore and manycore complexity. However, because they include completely new features, programmers and architects must learn a new programming model.

This chapter is about some of the new classes, structures, and enumerations that allow you to deal with data parallelism scenarios. Instead of focusing on the most complex problems related to parallel programming, this chapter shows you how to create parallel code and describes the new concepts related to each scenario. This way, you will more fully understand the performance improvements.

LAUNCHING PARALLEL TASKS

With previous .NET Framework versions, it was difficult to develop applications capable of taking full advantage of multicore microprocessors. It was necessary to launch, control, manage, and synchronize multiple threads using complex structures that were capable of handling some concurrency ...

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