Summary
Taking advantage of multicore machines is becoming increasingly important. From a programmer’s point of view, various facilities in the System.Threading libraries make it easier to do so.
In this chapter, we explored the notion of task parallelism centered around the Task and Task<TResult> types. We discussed how to create tasks, await their results, work with continues, and deal with various aspects such as errors and cancellation. In summary, tasks are the new means to perform work asynchronously, whether it’s long running (where you’d have used threads before) or more ad hoc short-lived computations (using thread pools before). We also discussed how the task scheduler works, layered atop of the improved thread pool, employing techniques ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access