.NET Parallel Programming

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

Creating pre-completed Tasks

 We’ve been considering adding support for creating completed Tasks from an existing result.  Here’s a prototypical example of where this could be valuable. void Task<float> ComputeAsync(...) {     if (!resultIsCached)     {         return Task<...

PLINQ and Office Add-ins

Many different kinds of applications can benefit from multi-core parallelism, including add-ins to Microsoft Office. Donny Amalo wrote a paper, PLINQ and Office Add-ins, where he demonstrates how to implement two parallel Microsoft Office add-ins using PLINQ: (This paper and many more are available through the Parallel Computing ...

Integrating Parallelism with Windows Workflow Foundation

Despite the similarity in naming, the System.Threading.Tasks.Parallel class and the System.Activities.Statements.Parallel* activities in WF4 are largely orthogonal in the scenarios they address. However, WF4 activities and the new parallel programming types in .NET 4 can be used together to great advantage.Ling Wo and Cristina Manu wrote ...

Lesser-known Multi-threaded Debugging Support in Visual Studio 2010

We’ve been very excited about the new debugging windows in Visual Studio 2010, namely Parallel Tasks and Parallel Stacks, as well as the newly revamped Threads window, and thus we’ve talked about them quite a bit. For an overview, you can read the MSDN Magazine article at https://msdn.microsoft.com/en-us/magazine/ee410778.aspx, and Daniel ...

Why is TaskContinuationsOptions.ExecuteSynchronously opt-in?

For a relatively advanced feature, I've been surprised how often this question has come up recently. When a task completes, its continuations become available for execution, and by default, a continuation will be scheduled for execution rather than executed immediately.  This means that the continuation has to be queued to the ...

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