.NET Parallel Programming

All about Async/Await, System.Threading.Tasks, System.Collections.Concurrent, System.Linq, and more…

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

(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 ...

ParallelExtensionsExtras Tour – #15 – Specialized Task Waiting

(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 ...

ParallelExtensionsExtras Tour – #14 – SingleItemPartitioner

(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 ...

ParallelExtensionsExtras Tour – #13 – AsyncCall

(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 ...

ParallelExtensionsExtras Tour – #12 – AsyncCache

(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 ...