.NET Parallel Programming

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

Task.Run vs Task.Factory.StartNew

In .NET 4, Task.Factory.StartNew was the primary method for scheduling a new task.  Many overloads provided for a highly configurable mechanism, enabling setting options, passing in arbitrary state, enabling cancellation, and even controlling scheduling behaviors.  The flip side of all of this power is complexity.  You need to ...

New articles on async/await in MSDN Magazine

(image) The October 2011 issue of MSDN Magazine is now available online.  In it, you can find three articles about the new async/await features of C# and Visual Basic.  While the articles can stand alone, they were written with each other in mind in order to provide a 1-2-3 on-ramp into the world of asynchronous programming with ...

Keeping Async Methods Alive

Consider a type that will print out a message when it’s finalized, and that has a Dispose method which will suppress finalization: class DisplayOnFinalize : IDisposable {     public void Dispose() { GC.SuppressFinalize(this); }     ~DisplayOnFinalize() { Console.WriteLine(“Finalized”); } } Now ...

Don’t Forget To Complete Your Tasks

“Don’t forget to complete your tasks.”  That guidance may sound trivial and silly, but I recently saw it as a source of a bug in software written by some very smart folks, and thus thought this would be a good opportunity to remind folks of the imperative.Tasks represent a promise.  If you hand one out, someone else...

Task Exception Handling in .NET 4.5

For the .NET Framework 4.5 Developer Preview, a lot of work has been done to improve the Task Parallel Library (TPL), in terms of functionality, in terms of performance, and in terms of integration with the rest of the .NET Framework.  With all of this work, we’ve strived for a very high compatibility bar, which means your ...

Updated TPL Dataflow CTP

It’s been a few months since April when we last released a Community Technology Preview (CTP) of System.Threading.Tasks.Dataflow.dll, aka “TPL Dataflow”.  Today for your programming pleasure, we have another update.As mentioned in “What’s New for Parallelism in .NET 4.5”, System.Threading.Tasks.Dataflow...