Parallel Extensions Extras

The TPL (Task Parallel Library) of NET 4 contains a plethora of datatypes for implicit / explicit data and task parallelism + several synchronization primatives. Of course, when you learn something, its never the end of the story…

http://code.msdn.microsoft.com/ParExtSamples contains a class library which leverages and complements the functionality available in the .NET Framework 4 TPL. Please find below my spelunk into this class library:

Parallel General Extensions

  • AggregateExceptionExtensions

111410 1427 ParallelExt1

  • BlockingCollectionExtensions – the precursor to C# 5 Asynchrony TAP pattern Join construct ?

111410 1427 ParallelExt2

  • CompletedTask – provides access to an already completed task – useful for using ContinueWith overloads that arnt StartNew equivelents

111410 1427 ParallelExt3

  • ConcurrentDictionaryExtensions

111410 1427 ParallelExt4

  • IProducerConsumerCollectionExtensions

111410 1427 ParallelExt5

  • LazyExtensions

111410 1427 ParallelExt6

  • LinqToTasks – provides LINQ support for Tasks

111410 1427 ParallelExt7

  • ParallelLinqOptions – provides a grouping for PLINQ options

111410 1427 ParallelExt8

  • PlinqExtensions

111410 1427 ParallelExt9

  • TaskCompletionSourceExtensions

111410 1427 ParallelExt10

  • TaskExtensions

111410 1427 ParallelExt11

Coordination Data Structures

  • ActionCountdownEvent – runs an Action when a CountdownEvent reaches zero

111410 1427 ParallelExt12

  • AsynchCache – Caches asynchronously retrieved data – eg streamed data

111410 1427 ParallelExt13

  • ConcurrentPriorityQueue – a thread safe priority queue structure

111410 1427 ParallelExt14

  • ConcurrentRandomNumberGenerator – a thread safe psuedo random number generator

111410 1427 ParallelExt15

  • ObjectPool – a thread safe random number generator

111410 1427 ParallelExt16

  • ObservableConcurrentCollection – a thread safe concurrent collection for use with data binding

111410 1427 ParallelExt17

  • ObservableConcurrentDictionary – a thread safe concurrent dictionary for use with data binding

111410 1427 ParallelExt18

  • Pipeline – provides support for pipeline data processing

111410 1427 ParallelExt19

111410 1427 ParallelExt20

  • ProducerConsumerCollectionBase – Provides a base implementation for producer-consumer collections that wrap other producer-consumer collections.

111410 1427 ParallelExt21

  • ReductionVariable – Provides a reduction variable for aggregating data across multiple threads involved in a computation

111410 1427 ParallelExt22

  • SpinLockClass – provides a simple referrence type wrapper for SpinLock struct

111410 1427 ParallelExt23

APM

  • FileAsync – provides asych counterparts to members of the File class

111410 1427 ParallelExt24

  • StreamExtensions – extension methods for asynchronously working with streams

111410 1427 ParallelExt25

  • WebRequestExtensions - extension methods for asynchronously working with web requests

111410 1427 ParallelExt26

EAP

  • EAPCommon

111410 1427 ParallelExt27

  • PingExtensions – extension methods for asynchronously working with Ping

111410 1427 ParallelExt28

  • SmtpClientExtensions – extension methods for asynchronously working with SMTP client

111410 1427 ParallelExt29

  • WebClientExtensions – extension methods for asynchronously working with Web Client

111410 1427 ParallelExt30

TaskFactoryExtensions

  • TaskFactoryExtensions

111410 1427 ParallelExt31

  • SelfReplicatingTask – provides a task capable of replicating itself

111410 1427 ParallelExt32

Parallel Algorithms

  • ParallelAlgorithms

111410 1427 ParallelExt33

Partitioners

  • ChunkPartitioner – partitions an enumerable into chunks based on user supplied criteria

  • RangePartitioner – partitions a range into sub-ranges. For very small loop bodies with a large number of iterations that require equal amounts of processing time, Parallel.ForEach with a RangePartitioner may be more efficient than a Parallel.For.

111410 1427 ParallelExt34

Task Schedulers

  • IOTaskScheduler - Provides a task scheduler that targets the I/O ThreadPool

    111410 1427 ParallelExt35

  • LimitedConcurrencyLevelTaskScheduler - Provides a task scheduler that ensures a maximum concurrency level while running on top of the ThreadPool.

  • OrderedTaskScheduler - Provides a task scheduler that ensures only one task is executing at a time, and that tasks execute in the order that they were queued.

    111410 1427 ParallelExt36

  • PrioritizingTaskScheduler - Provides a task scheduler that supports reprioritizing previously queued tasks

    111410 1427 ParallelExt37

  • RoundRobinTaskScheduler - Enables the creation of a group of schedulers that support round-robin scheduling for fairness.

    111410 1427 ParallelExt38

  • StaTaskScheduler - Provides a scheduler that uses STA threads

    111410 1427 ParallelExt39

  • SynchronizationContextTaskScheduler - Provides a task scheduler that targets a specific SynchronizationContext

    111410 1427 ParallelExt40

  • ThreadPerTaskScheduler - Provides a task scheduler that dedicates a thread per task

    111410 1427 ParallelExt41

  • WorkStealingTaskScheduler -

111410 1427 ParallelExt42111410 1427 ParallelExt43

This article is part of the GWB Archives. Original Author: JoshReuben

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.