Chapter 6. Task-based Parallelism

In this chapter we will cover the Task Parallel Library (TPL) and the details of using the Task class to write concurrent code.

In Chapter 5, Lightweight Concurrency – Task Parallel Library (TPL), we started our exploration of lightweight concurrency and .NET's new most preferred way to accomplish multithreaded programming—the TPL. In this chapter, we will explore task-based parallelism further and show how to wait on tasks or multiple tasks, custom scheduling of a task, error handling, and canceling a task.

The TPL gives us an easy way to schedule, run, and coordinate tasks at a higher level of abstraction than working directly with threads. As mentioned earlier, a task is a set of instructions to carry out an ...

Get C# Multithreaded and Parallel Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.