Editorials

Parallel Isn’t Always the Best

I’ve been talking a lot about parallel programming as the way to more fully utilize contemporary computers with multiple cores. Today I wanted to qualify those statements a bit. The main point I wish to make today is that even though you can generate parallel execution much easier today with new libraries, it is possible to actually slow down your processing by working parallel.

If the task is too small, the overhead of creating, managing, and locking shared objects can actually result in slower performing software.

Certainly when having applications that need to be responsive to user input you should use a different thread to perform background work. However, if you are trying to use a Parallel.ForEach method looping through methods that take very little time to complete, you may be doing yourself a disservice.

From what I have been reading on the Async libraries using Tasks and Await method, it seems that the best way to know if you are getting the desired performance is simply to try and measure the difference. Probably with some experience you can begin to predict what tasks will benefit from a Parallel execution, and which won’t.

You can get into the conversation by sharing your thoughts on parallel execution here or by Email to btaylor@sswug.org.

Cheers,

Ben