.Net Framework 4.0 brought a new feature to simplify parallel development that runs your application on computers and workstations that have two or more cores. Still, unlike mainframe systems this is not going to enable you to run your application on a specific core (CPU). However, it does provide a lot more easier way to develop your multi-thread application. Let's see what it can do now.
First, take a quick look of this picture about the architecture of the parallel programming in .NET Framework 4.0. The Parallel Programming in .NET 4.0 is composed of the following:
The Task Parallel Library (TPL): this is the base of the Task-based programming (System.Threading.Tasks Namespace). It consists of:
- Task class: the unit of work you will code against instead of the previous thread model.
- Parallel class: a static class that exposes a task-based version of some parallel-nature problems. More specifically, it contains the following methods:
- Parallel.For():Executes a for loop in which iterations may run in parallel
- Parallel.Foreach():Executes a foreach loop in which iterations may run in parallel
- Parallel.Invoke(): Executes each of the provided actions, possibly in parallel.
Parallel LINQ (PLINQ): built on top of the TPL and exposes the familiar LINQ as Parallel extensions.
No comments:
Post a Comment