Stats

609 Contributors: 15 Friday, November 4, 2016
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap
Download eBook

Task Parallel Library (TPL)

Download .net eBook

Remarks

Purpose And Use Cases

The purpose of the Task Parallel Library is to simplify the process of writing and maintaining multithreaded and parallel code.

Some Use Cases*:

  • Keeping a UI responsive by running background work on separate task
  • Distributing workload
  • Allowing a client application to send and receive requests at the same time (rest, TCP/UDP, ect)
  • Reading and/or writing multiple files at once

*Code should be considered on a case by case basis for multithreading. For example, if a loop only has a few iterations or only does a small amount of the work, the overhead for parallelism may outweigh the benefits.

TPL with .Net 3.5

The TPL is also available for .Net 3.5 included in a NuGet package, it is called Task Parallel Library.

Related Examples