One Man's Task Is Another's Cup 'o Joe
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.