Showing results for ParallelExtensionsExtras - .NET Parallel Programming

Nov 21, 2010
0
1

Processing Sequences of Asynchronous Operations with Tasks

Stephen Toub - MSFT
Stephen Toub - MSFT

Of late, I’ve seen multiple folks asking about how to use tasks to asynchronously execute a sequence of operations.  For example, given three synchronous functions: public string DoA(string input); public string DoB(string aResult); public string DoC(string bResult); you could invoke these functions with code like: strin...

Parallel ExtensionsTask Parallel Library.NET 4
May 4, 2010
0
0

ParallelExtensionsExtras Tour – #16 – Async Tasks for WebClient, SmtpClient, and Ping

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.) The Task Parallel Library isn’t just about CPU-bound operations.  The Task class is a great representation for any asynchronous operation, even those implemented purely as asynchronous I/O.Task’s ability to represent arbitrary asynchronous operations without...

Parallel ExtensionsTask Parallel Library.NET 4
May 4, 2010
0
0

ParallelExtensionsExtras Tour – #15 – Specialized Task Waiting

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.)The Task Parallel Library provides the Task.Wait method, which synchronously waits for the target Task to complete.  If the Task completed successfully, the method simply returns.  If the Task completed due to an unhandled exception or cancellation, Wait throws an app...

Parallel ExtensionsTask Parallel Library.NET 4
Apr 28, 2010
0
0

ParallelExtensionsExtras Tour – #14 – SingleItemPartitioner

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.) In a previous ParallelExtensionsExtras Tour blog post, we talked about implementing a custom partitioner for BlockingCollection<T>.  Custom partitioning is an advanced but important feature supported by both Parallel.ForEach and PLINQ, as it allows the develope...

Parallel ExtensionsTask Parallel Library.NET 4
Apr 27, 2010
0
0

ParallelExtensionsExtras Tour – #13 – AsyncCall

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.)Producer/consumer scenarios could logically be split into two categories: those where the consumers are synchronous, blocking waiting for producers to generate data, and those where the consumers are asynchronous, such that they're alerted to data being available and only then ...

Parallel ExtensionsTask Parallel Library.NET 4
Apr 23, 2010
0
0

ParallelExtensionsExtras Tour – #12 – AsyncCache

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.)Caches are ubiquitous in computing, serving as a staple of both hardware architecture and software development.  In software, caches are often implemented as dictionaries, where some data is retrieved or computed based on a key, and then that key and its resulting data/val...

Parallel ExtensionsTask Parallel Library.NET 4
Apr 15, 2010
0
0

ParallelExtensionsExtras Tour – #11 – ParallelDynamicInvoke

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.)  Delegates in .NET may have one or more methods in their invocation list.  When you invoke a delegate, such as through the Delegate.DynamicInvoke method, the net result is that all of the methods in the invocation list get invoked, one after the other.  Of...

Parallel Extensions.NET 4Code Samples
Apr 14, 2010
0
0

ParallelExtensionsExtras Tour – #10 – Pipeline

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.)  Producer/consumer is a fundamental pattern employed in many parallel applications.  With producer/consumer, one or more producer threads generate data that is consumed by one or more consumer threads.  These consumers can themselves also be producers of f...

Parallel Extensions.NET 4Code Samples
Apr 13, 2010
0
0

ParallelExtensionsExtras Tour – #9 – ObjectPool

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.) An object pool is a mechanism/pattern to avoid the repeated creation and destruction of objects.  When code is done with an object, rather than allowing it to be garbage collected (and finalized if it’s finalizable), you put the object back into a spe...

Parallel Extensions.NET 4Code Samples
Apr 12, 2010
0
0

ParallelExtensionsExtras Tour – #8 – ReductionVariable

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.) The new .NET 4 System.Threading.ThreadLocal<T> is quite useful when you need per-thread, per-instance storage.  This is in contrast to the fast ThreadStaticAttribute, which supports only per-thread storage (in .NET 4, ThreadLocal<T> actually layers o...

Parallel Extensions.NET 4Code Samples