.NET – Relationship Between Task Parallel Library and Task-Based Asynchronous Pattern

multithreadingnet

In the context of C#, .NET 4/4.5 used for an application running on a web-server, what is the relationship between "Task Parallel Library" and "Task-based Asynchronous Pattern"?

I understand one is a library and the other is a pattern. But to dig deeper, is it like "The library is used by the pattern to enforce good practices". I'm also not clear if both are supported in .NET 4.0 (with await and async keywords)

Edit: Seems that await and async are only in .NET 4.5 …

Best Answer

The TPL is a new(ish) framework that provides a simplified API for concurrent programming. The Task-Based Asynchronous Pattern is a framework design guideline that leverages the TPL to deliver consistently designed concurrent operations.

The async/await keywords are syntactic sugar that allow you to consume TAP APIs without diving into the details of continuation.