5

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 ...

asked Nov 27, 2012 at 20:08
8
  • 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. Commented Nov 27, 2012 at 20:12
  • clarified and linked up Commented Nov 27, 2012 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) Commented Nov 27, 2012 at 20:22
  • 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 Commented Nov 27, 2012 at 22:22
  • 1
    @JimmyHoffa - TAP is just a number of conventions around methods returning Task instances, and is not directly related to CPS. The C# async/await features simplify writing task continuations however. Commented Nov 27, 2012 at 22:27

1 Answer 1

4

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.

answered Nov 27, 2012 at 20:59
2
  • so TPL extends TAP or TAP extends TPL? Put another way, TPL is newer/preferred compared to TAP? Commented Oct 20, 2016 at 14:08
  • 1
    @mmcrae - if I understand correctly, they are not extensions of each other. It seems from this answer that TPL is a framework to make life easier for developers. TAP is a design guideline (a pattern) that uses TPL as part of its guideline/recommendation for how to design concurrent operations in a consistent way. Michael Brown - I have explained that accurately? Commented Nov 21, 2016 at 16:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.