When to Choose Async and TPL
Recent versions of .Net Framework provides two good features.
I hear from a lot of people who are confused about when to use these features. These two are solving 2 different problems of computer science.
- Need for faster processing (CPU)
- Waiting for dependent operations
Task parallel Library(TPL) optimally uses the multi-core CPU’s and reduces the time spent in doing a complex computation (like finding the millionth prime number). However, Async/Await keywords can help utilize the time wasted in waiting for completing dependent operations (like waiting for File writing, availability of port/buffer etc).
I hope this will give you a basic understanding of how these two features are different and when to use them.