The Task Parallel Library

.NET Framework 4 introduces the Task Parallel Library (TPL) as the new way to go about writing parallel programs. Key benefits of the TPL include the following:

• Efficient utilization of the cores available in the machine

• Intuitive programming model, leveraging lambda expressions and generics

• Support for task-oriented parallelism based on the notion of Task<T>

• Data-oriented parallelism with parallel iteration and PLINQ queries

• Composition of asynchronous computations

So you might wonder why we bothered talking about classic threading in Chapter 29 at all, if the TPL is all you need. There are a couple of answers to this question. First, it’s good to know about the primitives that underpin higher levels of ...

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.