上QQ阅读APP看书,第一时间看更新
Task parallel library (TPL)
So far, we have learned some core concepts about multithreading, and have used threads to perform multiple tasks. Compared to the classic threading model in .NET, TPL minimizes the complexity of using threads and provides an abstraction through a set of APIs that helps developers to focus more on the application program instead of focusing on how the threads will be provisioned, as well as other things.
There are several benefits of using TPL over threads:
- It autoscales the concurrency to a multicore level
- It autoscales LINQ queries to a multicore level
- It handles the partitioning of the work and uses ThreadPool where required
- It is easy to use and reduces the complexity of working with threads directly