Visual C++ 2010 technology preview parallel programming example

Print Friendly, PDF & Email

An article over at CodeGuru.com for those of you interested in test driving the Visual C++ 2010 CTP

The CTP build of Visual C++ 2010 includes a new library to help you write native parallel code. Writing parallel code is getting more and more important with the broad availability of quad-core CPUs at this time and the many-core CPUs that will appear in the coming years. I will only be talking about the new concurrency library for native code. Of course, writing parallel code has already been possible for a long time. However, you had to create and manage all threads by yourself and this could often be a complex task. Because of this, it requires quite a bit of time to parallelize a simple loop over multiple threads. The new native concurrency library makes this much easier.

This article will explain the parallel_for construct that is part of the native concurrency library in more detail and will briefly touch on a few other constructs. For the example, I will parallelize a trivial implementation of a Mandelbrot fractal renderer.

With actual code.