i didnt use TPL that much in .net 4 but i know its great for multi-core Applications
but in PDC i saw them announcing Async CTP & i only saw Async in F#
my Question is what is the difference between them & what are the best practices for each of them
thanks in advance
Await & Async was built on the Task Parallel Library (TPL) which was introduced in the . NET Framework 4. Their purpose is to enable asynchronous programming.
The Task Parallel Library (TPL) is a set of public types and APIs in the System. Threading and System. Threading. Tasks namespaces. The purpose of the TPL is to make developers more productive by simplifying the process of adding parallelism and concurrency to applications.
Compared to the classic threading model in . NET, Task Parallel Library minimizes the complexity of using threads and provides an abstraction through a set of APIs that help developers focus more on the application program instead of focusing on how the threads will be provisioned.
Using asynchronous programming indicates that a method can execute without waiting for another method to complete. Using async and await, we can run the methods above parallelly. Example 2: C#
The async features in C# 5 will use the TPL... which is just a library, of course. Asynchronous methods will simply make it a lot easier to use the TPL... given appropriate relatively-low-level async operations (e.g. "fetch a web page asynchronously" or "read a block of data asynchronously" it will be fairly easy to build higher-level asynchronous operations.
In terms of best practices - for TAP (Task-based Asynchronous Pattern) there's an interesting white paper. For parallel programming in general with .NET, there's a book by the Patterns and Practices group, "Parallel Programming with Microsoft .NET" and also Joe Duffy's book "Concurrent Programming on Windows" - although the latter predates the TPL slightly.
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