Sunday, June 29, 2008

[2008.06.29] Parallel Extensions

We are now living in the age of multicore CPU and there is great potential for this generation of hardware. But all this wonderful hardware is pointless if the software that runs on it is outdated and not scalable to take advantage of the ManyCore or MultiProc environment. As applications evolve and process more data, it is clear that we would like to do process all of the data both faster and safer.

Multithreading is nothing new but programming in a concurrent environment is probably a daunting task for developers (myself included). There are many little details that require constant attention in order to program a viable, multithreaded application. Microsoft Research is currently working on making concurrent and parallel programming much more straight forward by abstracting a lot of the underlying concepts to a much higher level.

Parallel Extensions [PE] is a managed library to the .NET Framework 3.5. It is designed to simplify parallel programming when using any of the .NET languages. Basically, with very little modification of your existing code base, you can convert your sequential processing application to one that is fully parallel and scalable. The PE library is built from the ground up and it is written in C#. It is composed of several parts:

  • Coordinate Data Structures [CDS]
  • Scheduler
  • Task Parallel Library
  • Parallel LINQ

You can download the June 2008 CTP of Parallel Extensions. Installing the CTP is very straight forward.

To access the types in the library, you have to add it to your project. So after you create your project, in the Solutions Explorer, right click and select Add Reference... This will bring up the list of references that can be added to the project. The image shows what you are looking for.

pe_01
Access the PE library in the System.Threading namespace

I will continue this posting by first looking at the CDS, the TPL and then PLINQ. As stated, I am learning how to use this library and I will share what I know as I go along. Basically, I will take information from the June CTP help file as well as from interviews given by the team members so as to create a complete picture of what is going on. Stay tuned for more.

No comments: