Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
At the core of the TPL is the Task class. With the TPL, the basic unit of execution is encapsulated by Task, not Thread. Task differs from Thread in that Task is an abstraction that represents an asynchronous operation. Thread encapsulates a thread of execution. Of course, at the system level, a thread is still the basic unit of execution that can be scheduled by the operating system. However, the correspondence between a Task instance and a thread of execution is not necessarily one-to-one. Furthermore, task execution is managed by a task scheduler, which works with a thread pool. This means that several tasks might share the same thread, for example. The Task class (and all of the TPL) is defined in System.Threading.Tasks.
There are various ways to create a new Task and start its execution. We will begin by first creating a Task using a constructor and then starting it by calling the Start( ) method. Task defines several constructors. Here is the one we will be using: