How to build a consistent mental model for reasoning about concurrency - Embedded.com

How to build a consistent mental model for reasoning about concurrency

Quick: What does “concurrency” mean to you? To your colleagues? Toyour project?

You probably know the fable of the blind men and the elephant:Several blind men explore an elephant by feel, and each one draws hisown conclusion about what the elephant is. The man at the tailconcludes that the elephant is like a rope; the one at the tusk assertsthat, no, the elephant is like a spear; the one at the leg thinks it'slike a tree; the one at the ear that it's like a fan; and so on.

The blind men argue, each one knowing he is “right” from his ownexperience and point of view. In time, several give up hope of everagreeing on what the creature is, and some resign themselves toaccepting that the best they can do is deeply analyze each disconnectedpart in isolation as its own separate self. Meanwhile, the poorelephant waits patiently, faintly puzzled, because of course, it is notlike any of those things alone and it doesn't see itself as that hardto understand as a whole creature.

Have you ever talked with another developer about concurrency, andfelt as though you were somehow speaking completely differentlanguages? If so, you're not alone. You can see the confusion in ourvocabulary (and this is not an exhaustive list):

acquire, and-parallel, associative, atomic, background, cancel,consistent, data-driven, dialogue, dismiss, fairness, fine-grained,fork-join, hierarchical, interactive, invariant, isolation, message,nested, overhead, performance, priority, protocol, read, reduction,release, structured, repeatable, responsiveness, scalable, schedule,serializable update, side effect, systolic, timeout, transaction,throughput, virtual, wait, write,…

Some of the words have many meanings (performance, for instance),while others are unrelated (responsiveness and throughput, forexample). Much of the confusion we may encounter arises when peopleinadvertently talk past each other by using incompatible words.

A basic problem is that this shouldn't be a single list. But how canwe group these terms sensibly, when experienced parallel programmersknow scores or hundreds of different concurrency requirements andtechniques that seem to defy grouping?

Click here to read more)

Herb Sutter is a software architectat Microsoft and chair of the ISO C++ Standards committee. He can becontacted at www.gotw.ca.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.