Channels ▼

James Reinders

Dr. Dobb's Bloggers

Predicatable/Deterministic Parallel Programs: Step One

April 08, 2008

Keeping your application predicatable and deterministic is the hardest part of writing a parallel program.

Step One, don't use raw threading packages.

Much of the blame has to be placed on the models we use to program, especially threading. The problems are so bad, that we need to use some form of abstraction higher than "raw native threads" (pthreads, Windows threads, boost threads, Java threads).

In a paper, "The Problem with Threads," Edward A. Lee at the University of California, Berkeley, makes a "Sky is Falling" argument for the end of the world because of threading. Perhaps I exaggerate a bit, but Ed exaggerates a bit too much in predicting the near destruction of life as we know it because of threading.

Ed says " [If] the next generation of programmers makes more intensive use of multithreading, then the next generation of computers will become nearly unusable."

I agree with Ed's central point: we need to stress understandability, predictability, and determinism in programming.

Are we in danger of losing our way?

Ed makes a case that the world is going to use multithreading so much that computers are useless.

But there are solutions, and they are getting adopted. Some try to be complete (functional languages), and others try to contain the problem (evolutionary approaches).

Either way, we need help.

The first step, use something other than raw threading packages.

My favorites so far: OpenMP, Threading Building Blocks and threaded libraries (many to choose from).

There is a lot more we can do - more on that later.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.