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
System.Runtime.Caching.MemoryCache (ObjectCache)
Basic producer-consumer loop (BlockingCollection)
Next
This modified text is an extract of the original Stack Overflow Documentation created by following
contributors and released under
CC BY-SA 3.0