One of the main benefits of the Task Parallel Library versus developing using the
Thread class is the
TaskScheduler. This class does a lot of the logic that you had to program into your multithreaded code to achieve maximum performance and efficiency. This is what truly makes using TPL "lightweight" concurrency programming. The main job of the
TaskScheduler class is to handle the work of queuing tasks to threads, or more specifically, the
ThreadPool, and managing the
ThreadPool to best utilize the number of processing cores on the machine it is being executed on.
One of the best features of the
TaskScheduler is that it is an
abstract class that you can derive your own classes from. The
TaskScheduler allows you to schedule tasks ...