Parallel Extensions: Difference between revisions

Content deleted Content added
Fixed broken reference name, edit changed one of the names, not both!!!!
Citation bot (talk | contribs)
m Alter: isbn. Add: citeseerx, pages. | You can use this bot yourself. Report bugs here. | User-activated.
Line 7:
 
==Task Parallel Library==
The '''Task Parallel Library''' ('''TPL''') is the [[task parallelism]] component of the Parallel Extensions to .NET.<ref name="Concurrent Programming on Windows Appendix B"/> It exposes parallel constructs like parallel <code>For</code> and <code>ForEach</code> loops, using regular method calls and [[Delegate (CLI)|delegate]]s, thus the constructs can be used from any [[List of CLI languages|CLI languages]]. The job of spawning and terminating [[Thread (computing)|threads]], as well as scaling the number of threads according to the number of available processors, is done by the library itself,<ref name="msdnmag"/> using a [[work stealing]] scheduler.<ref>{{cite journal |last1=Leijen |first1=Daan |first2=Wolfram |last2=Schulte |first3=Sebastian |last3=Burckhardt |title=The Design of a Task Parallel Library |journal=ACM SIGPLAN Notices |volume=44 |issue=10 |pages=227 |year=2009| doi = 10.1145/1639949.1640106 |citeseerx=10.1.1.146.4197 }}</ref>
 
TPL also includes other constructs like ''Task'' and ''[[Future (programming)|Future]]''. A ''Task'' is an action that can be executed independent of the rest of the program. In that sense, it is semantically equivalent to a thread, except that it is a more light-weight object and comes without the overhead of creating an OS thread. Tasks are queued by a ''Task Manager'' object and are scheduled to run on multiple OS threads in a [[thread pool pattern|thread pool]] when their turn comes.
 
''Future'' is a task that returns a result. The result is computed in a background thread encapsulated by the ''Future'' object, and the result is buffered until it is retrieved.<ref name="msdnmag"/> If an attempt is made to retrieve the result before it has been computed then the requesting thread will block until the result is available.<ref name="Concurrent Programming on Windows Appendix B">{{cite book | first=Joe | last=Duffy | year=2009 | title=Concurrent Programming on Windows | isbn=032143482X978-0321434821| pages="887–929" }}</ref>
 
The other construct of TPL is '''Parallel''' class.