I want to clarify the difference between two these abbreviations: TPL
(a task parallel library) and TAP
(task async pattern).
AFAIU, TPL
- is a task parallel library and the main part of this library is Task
and all related staff. So, it's like a technology which was implemented by Microsoft
.
TAP
- it's a pattern which underlies to async
/await
syntax sugar. And which is based on callback
function + state machine
+ SynchronizationContext
logic.
Is there something to add or correct?
TPL is a part of the BCL. It includes Task
as well as several other parallelism-related higher-level abstractions including Parallel
and Parallel LINQ. The focus of TPL was parallel processing, and using tasks as futures - while supported - was a relatively unused feature.
TAP is a pattern. It's called "Task-based" because it reused the Task
type from the TPL as a generic Future type. Task
(and related types) were enhanced to include more primitives to support TAP and asynchronous programming (e.g., GetAwaiter()
, Task.WhenAll
, etc). These days, TAP also works with "tasklikes" including ValueTask
. TAP is focused on asynchronous programming as opposed to parallel processing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With