Parallel extensions

from Wikipedia, the free encyclopedia
Important parts of the .NET Framework

The Parallel Extensions , also known as Parallel Framework Extensions (PFX), is a library to support parallel programming when using the managed code of the Microsoft .NET Framework . The parallel extensions basically consist of two parts: Parallel LINQ (PLINQ) and the Task Parallel Library (TPL). The library has various data types (referenced objects) and functions for managing and controlling parallel processes during runtime. The library first appeared (as a CTP ) on November 29, 2007 and was updated in December 2007 and June 2008. Since version 4.0 of the .NET framework, the parallel extensions have been an integral part of the framework and can be used in all .NET languages.

Parallel LINQ

Parallel LINQ ( PLINQ ) offers the possibility of executing LINQ queries in parallel, provided that it can create a time advantage (SpeedUp) compared to a sequential query. Either several LINQ queries are called in parallel or the data volume itself is collated in parallel. The aim of PLINQ is to minimize the computing time for the queries. As a rule, parallelization works with all types of queries. PLINQ can be used via the IParallelEnumerable interface. Internally, PLINQ uses the TPL for parallelization.

Task parallel library

The Task Parallel Library ( TPL ) is the core component for parallelization within the .NET framework. It also makes it possible to mask certain areas as a task or future . A task is a section that can be executed independently (and thus in parallel) from the rest of the program. The TPL creates its own thread for this, which, however, is managed by the TPL itself and thus does not generate any unnecessary overhead (as is otherwise required). The developer himself does not have to worry about managing the individual threads or the number of processor cores, as this is completely managed by the TPL.

The TPL recognizes possible tasks to be carried out in parallel by means of certain code sections (e.g. loops such as Foror ForEach). The TPL can also be enforced for other tasks.

A task is called a future that returns a result that was calculated in a parallel process. The result is then held on completion until it is called up. If the result is requested before completion, the requesting thread is paused until the result has been calculated.

The TPL can be used via the Parallel class. This class provides three static methods:

Parallel Invoke
Executes (in parallel) an array of delegates and waits for them to be calculated.
Parallel.For
Corresponds to the for loop in C #, but with parallel execution.
Parallel.ForEach
Corresponds to the foreach loop in C #, but with parallel execution.

Dataflow

Dataflow is a .NET library based on TPL with predefined blocks for data stream-oriented programming .

architecture

The concept of parallel extensions in .NET is based on Taskdividing certain sections of code into one . This task represents a task that is as independent as possible from other parts of the program. Both PLINQ and the TPL API provide methods for defining corresponding tasks. PLINQ automatically creates tasks from the queries, while the TPL from the above. Looping tasks generated.

See also

Individual evidence

  1. Programming in the Age of Concurrency: Concurrent Programming with PFX . Retrieved October 16, 2007.
  2. a b c MSDN Magazine: Task Parallel Library . Archived from the original on October 14, 2007. Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. Retrieved October 16, 2007. @1@ 2Template: Webachiv / IABot / msdn.microsoft.com
  3. a b c June 2008 CTP - Parallel Extensions to the .NET FX . Retrieved August 6, 2008.
  4. Parallel Extensions to the .NET FX CTP . Retrieved November 30, 2007.
  5. ^ Parallel Programming and the .NET Framework 4.0 . Retrieved January 25, 2009.
  6. More powerful aggregations in PLINQ . Retrieved August 6, 2008.
  7. ^ A b Joe Duffy: Concurrent Programming on Windows 2009, ISBN "032143482X", pp. "887-929".
  8. Dataflow (Task Parallel Library). In: MSDN. Microsoft, accessed June 1, 2014 .
  9. Introduction to TPL Dataflow. ( Microsoft Word document) Microsoft, accessed June 1, 2014 .