A Tour of Various TPL Options

The Task Parallel Library (TPL) exposes various options that give you more control over how tasks get scheduled and executed:

  • Choose whether to optimize for fairness or for overheads when scheduling tasks.
  • Specially mark tasks known to be long-running to help the scheduler execute efficiently.
  • Create a task as attached or detached to the parent task.
  • Schedule continuations that run if a task threw an exception or got cancelled.
  • Run tasks synchronously.

Joseph E. Hoag’s article A Tour of Various TPL Options explains these options in detail, accompanied by examples of correct and incorrect uses.

(This paper and many more are available through the Parallel Computing Developer Center on MSDN at http://msdn.microsoft.com/en-us/concurrency/ee851578.aspx.)