BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Parallel Programming with Microsoft .NET

by Abel Avram on Sep 02, 2010 |

The patterns&practices team has released Parallel Programming with Microsoft .NET, a book containing guidance for writing parallel programs for .NET. In essence the book contains 6 design patterns for parallel programming accompanied by code samples.

Parallel Programming with Microsoft .NET attempts to deal with the difficult job of decomposing a problem in multiple tasks which can be run in parallel, coordinating the parallel tasks and using data sharing between tasks in order to avoid the need for synchronization which dramatically can affect the performance of a parallel program. For that purpose, the book introduces 6 design patterns used with .NET 4 Task Parallel Library (TPL) and PLINQ:

  1. Parallel Loops - Used when one needs to apply the same operation to multiple similar data inputs.
  2. Parallel Tasks – Used when one needs to apply different operations, each with its own data input.
  3. Parallel Aggregation - “Parallel aggregation introduces special steps in the algorithm for merging partial results. This pattern expresses a reduction operation and includes map/reduce as one of its variations.”
  4. Futures – Used to integrate data flow with control flow. “A future is a stand-in for a computational result that is initially unknown but becomes available at a later time. The process of calculating the result can occur in parallel with other computations.”
  5. Dynamic Task Parallelism – Also known as recursive decomposition, this pattern helps adding dynamically created tasks during a computation.
  6. Pipelines – this pattern combines the parallel task concept with the concurrent queues one, allowing a program to concurrently execute tasks on data inputs and respecting the order in which data is processed.

Each design pattern is accompanied by C#, VB.NET and F# code samples, all available on the Parallel Programming with Microsoft .NET project on CodePlex. The project mentions the intent of the patterns&practices team to produce a companion book for C++ developers using the Parallel Patterns Library (PPL) and Asynchronous Agents Library.

The guide contains advice on integrating the parallel design patterns with other OOP patterns such as Façades, Decorators, and Repositories. It also shows how to debug and profile parallel applications in Visual Studio 2010.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

This is a long time coming... by Lou Marco

Parallel programming will soon be an essential skill set of any programmer. I've done my fair share, as lots have, and I know that each time the experience was like a dentist visit - developing the code was a nightmare but, once done, the results were wonderful.

To have some material, such as SAMPLES and 'accessable' reading matter available to other-than-Master-Jedi-programmers, the black art of parallel programming will seem less arcane and, with hope, more natural.

Full-features languages like C# and rather (for now) escoteric languages like F# are in the right place to exploit parallelism. And the .NET platform is widely used, robust and getting better with each release (and, no, I'm not a Microsoft bigot!)

Machines with multiple cores are the norm. In 5 years, how many cores and how much memory will be on 'standard' desktops? 16 cores? 128 gig? Imagine the tasks deemed impractical today because of resource limitations will be implemented!

It's a great time to be in this business...

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT