Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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 awake and async keywords)

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

share|improve this question
1  
One is a library that helps with running tasks in parallel. The other is a programming pattern for asynchronous tasks. They can work together. As an aside - you really should be linking to the sources of both phrases in your question. –  Oded Nov 27 '12 at 20:12
    
clarified and linked up –  DeepSpace101 Nov 27 '12 at 20:18
    
Read the articles you've linked. They explain it pretty well (the first sentence in the Task-based AP article clarifies your edit) –  Steve Evers Nov 27 '12 at 20:22
    
Concurrency and asynchrony though handled similarly because they both involve non-deterministic execution from the perspective of their initiators, they are not in fact the same. That said, I think the TAP is just another way of saying CPS so have a read here en.wikipedia.org/wiki/Continuation-passing_style –  Jimmy Hoffa Nov 27 '12 at 20:40
1  
async and await are C# features, not .Net features, although in the case of the Task class, the methods required by the compiler only exist in .Net 4.5. You can use async/await in .Net 4 using the 'async targeting pack': microsoft.com/en-us/download/details.aspx?id=29576 –  Lee Nov 27 '12 at 22:22
show 3 more comments

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.