Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Parallel Programming with Microsoft .NET

Parallel Programming with Microsoft .NET

This item in japanese


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.

Rate this Article


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.

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

Community comments

  • This is a long time coming...

    by Lou Marco,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    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

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