Channels ▼

Jonathan Erickson

Dr. Dobb's Bloggers

One Man's Task Is Another's Cup 'o Joe

April 14, 2010

I'm still in Barcelona, making do at a Starbucks coffee house. Starbucks you recall, is my office away from the office whenever and wherever I'm traveling.

Actually I'm at my third Starbucks of the day, which is on Ferran just off La Rambla. The thing is that Starbucks in Barcelona have free Internet access, but only four 45 minutes at a time (well, 90 minutes if you're a Starbucks VIP; I'm a Starbucks Gold Card carrier but that doesn't pull much weight in Spain). So I pack up and trek from one Starbucks to another for my online fix. Just another form of 'distributed' computing I guess. But how does Starbucks effectively limit you to 45 minutes? Easy, there are no electrical outlets readily available to plug into.

When I got up this morning I had every intention of not talking about Steve Tiexeria, a parallel programming guru at Microsoft, but I ran into him again as I was heading out for Starbucks and he was on his way for a personal tour of the Barcelona Supercomputer Center. If you ever wonder why Steve's career is taking off while mine is what it is, then remember who's hanging out at Starbucks vs. who is learning more about parallel programming in the extreme.

Thinking about how Steve and I approach work got me thinking of tasks I had to complete which reminded me of something Steve discussed in his presentation this week. Specifically, that 'tasks' are all the rage right now, at least compared to 'threads'. Threads represent execution flow, instead of getting work done. Threads are generally non-productive, and tend to be hard-coded with little latent parallelism. Threads can be, in otherwords, a bad thing when it comes to serious parallelism.

This explains in part why Microsoft has focused on a task-based programming model for Visual Studio 2010 and .NET 4 for both native- and managed-code. Tasks let you think in terms of the logical chunks of work within your program. In Visual Studio 2010, Microsoft has implemented this in terms of the Task Parallel Library (TPL); in Visual C++, it's the Parallel Pattern Library (PPL). More specifically, you think of Parallel.For in .NET 4, and parallel_for in C++. Of course, it goes much deeper in this, which is why you need to watch out for Steve's upcoming Dr. Dobb's article. In the meantime, think "tasks" not "threads."

If you have any questions, you can find me at the Starbucks on Passeig Gracia. Stop by if you're in the neighborhood. I'll be stationed back in the corner next to the door to the facilities -- but only for 45 minutes.

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.