A Common Question: Concurrency vs Parallelism

While presenting a .NET 4.0 session in GDC, i came across Parallel Computing. I allocated about 15 minutes to this topic since the session was a lap around .NET 4.0 features…
One of the questions I received and seemed to cause much of the confusion was the traditional one: What is the difference between Concurrency and Parallelism.

Well both concepts are related but not the same: In its simplest definition, Concurrency is about executing multiple un-related tasks in a concurrent mode. What these un-related tasks share are system resources, but they do not share a common problem to solve; meaning, they are logically independent. Now think of these tasks as threads. And since these threads share system resources, then you face the globally common problems of concurrent programming such as deadlocks and data races. This makes concurrent programming extremely difficult and debugging even more tendous.

So what is Parallelim? Parallelism is taking a certain task and dividing it into a set of realted tasks to be executed concurrently. Sweet! So again thinking of these tasks as threads, Parallel Programming still has the same problems of concurrent programming (deadlocks, data races, etc..) and introduces new challenges most notibly sharing and partitioning data across these related threads. This makes Parallel Programming even more difficult and debugging even more tendous 😦

However, it is not all bad news. .NET 4.0 parallel programming is a great step onwards. The new API solves a lot of problems (but not all) of Parallel Programming and greatly eases up Parallel Debugging…

I will post more about this great feature, but for now I hope the idea is clarified.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s