Microsoft's pattern & Practices Team recently published the "use.. Net for parallel programming (parallel programming with Microsoft. net.. net. The basic content includes six design patterns for parallel programming and corresponding code examples.
Usage. to solve the difficult tasks in parallel programs: decomposing problems in multiple tasks that can be run in parallel, and coordinating parallel tasks, and process data sharing between tasks to avoid the huge performance impact of synchronization. To achieve this goal, this book introduces six design patterns using the. NET 4 Task Parallel library (task parallel library, TPL) and Plinq:
- Parallel loop (Parallel Loops)-used when the same operation is performed on multiple similar data input.
- Parallel tasks is used when you need to execute different operations that have their own data input.
- Parallel aggregation-"parallel aggregation introduces special steps in the algorithm to merge incomplete results. This mode represents a simplified operation and contains a variant of the MAP/reduce algorithm ."
- Futures-used to integrate data streams through the control flow. "Futures are a substitute for computing results that were initially unknown but subsequently available. The computing process of the results can occur in other computing processes in parallel ."
- Dynamic Task parallelism, a so-called recursive decomposition, helps to add dynamically created tasks during computation.
- Pipelines: This mode combines the concept of parallel tasks and concurrent queues, allowing the program to execute tasks concurrently on top of data input and process data in a certain order.
Each design pattern is accompanied by C #, VB. NET, and F # code examples, which can be found on the project website where. NET is used for parallel programming on codeplex. This project also mentions that the pattern and practice team intends to use the parallel patterns Library (PPL) and asynchronous agents Library (asynchronous agents Library) C ++ developers, this book's sister-in-law.
This wizard also contains suggestions for integrating the parallel design mode with other OOP modes, such as facades, decorators, and repositiories ). It also demonstrates how to debug and analyze parallel applications in Visual Studio 2010.
View Original English text:Parallel Programming with Microsoft. NET
Http://www.infoq.com/cn/news/2010/09/Parallel-Programming-.NET;jsessionid=97210FA8CABF12C954FB281C45FA9AC3