INTRODUCTION

In 2007, Microsoft released the first Community Technology Preview (CTP) of Parallel Extensions for the .NET Framework. The old .NET Framework multithreading programming model was too complex and heavyweight for the forthcoming multicore and manycore CPUs. I had been researching parallel programming, multiprocessor, and multicore since 1997, so I couldn't help installing the first CTP and trying it. It was obvious that it was going to be an exciting new way of expressing parallelism in future C# versions.

Visual Studio 2010 ships with version 4 of the .NET Framework, the first release to include Parallel Extensions. C# 4 and .NET Framework 4 allow you to shift to a modern task-based programming model to express parallelism. It is easier to write code that takes advantage of multicore microprocessors. Now, you can write code that scales as the number of available cores increases, without having to work with complex managed threads. You are able to write code that runs tasks, and the Common Language Runtime (CLR) will inject the necessary threads for you. It is easy to run data parallelism algorithms taking advantage of multicore.

At the time of this writing, multicore microprocessors are everywhere. Servers, desktop computers, laptops and notebooks, netbooks, mobile Internet devices (MIDs), tablets, and even smartphones use multicore microprocessors. The average number of cores in each microprocessor is going to increase in the forthcoming years. Are you going to lose ...

Get Professional Parallel Programming with C#: Master Parallel Extensions With .NET 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.