.NET Parallel Programming

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

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

How to use C++ AMP from C#

[Updated 5/17/2012 for Visual Studio 11 Beta] In Visual Studio 11 Beta, C++ AMP enables you to accelerate your applications using heterogeneous hardware such as GPUs. If you are a .NET developer, you can still use C++ AMP in your applications. You’ll write most of your code in C#, the pieces to execute on the GPU in C++ AMP, and then ...

Quick microbenchmarks in Visual Studio with Code Snippets

Parallelism is all about performance.  After all, in the majority of cases, introducing parallelism into code adds some level of complexity, and the primary reason we’re ok with that additional complexity is because we get great performance enhancements as a result.  As such, as we develop our parallel runtimes and libraries to...

Using Tasks to implement the APM Pattern

Several times recently, folks have asked how to use tasks to implement the APM pattern, otherwise known as the Asynchronous Programming Model pattern, or the IAsyncResult pattern, or the Begin/End pattern.  While moving forward we encourage folks to use a Task-based pattern for exposing asynchronous operation, the APM pattern has been the...

More case studies on .NET 4 parallelism support

When .NET 4 was launched, we blogged about several case studies published regarding usage of .NET 4 to parallelize applications.  Quite recently, several additional case studies have been published.  I love reading these in order to better understand how folks are applying this technology, and parallelism in general, to improve their...

Static constructor deadlocks

One important fact to know about static constructors is that they effectively execute under a lock. The CLR must ensure that each type is initialized exactly once, and so it uses locking to prevent multiple threads from executing the same static constructor. A caveat, however, is that executing the static constructor under ...