Snow Leopard's Grand Central Dispatch and the Gift Horse's Mouth
First a disclaimer or at the very least an acknowledgment. We are heavy consumers of Mac technology at Ctest Labs. Our Pantheon cluster boasts several fully loaded multicore Macs. We combine Macs with Sun boxes and Linux boxes in a way that makes for a very formidable cluster-based supercomputer that we call the Pantheon. So right off the bat let me say that we have much love for the Mac.But that being said, we don't know what to make of Snow Leopard's new 'Grand Central Dispatch' (at least not yet). I admit we haven't written any code yet, but already we have some reservations. Once we've RTM our fears may be alleviated but at the moment we're just a wee bit skeptical. In Apple's words:
"Grand Central Dispatch (GCD) is a revolutionary approach to multicore computing. Woven throughout the fabric of Mac OSX version 10.6 Snow Leopard, GCD combines an easy-to-use programming model with highly efficient system services to radically simplify the code needed to make the best use of multiple processors."
In a nutshell here's what Apple says to developers:
"GCD gives developers a simple way to describe the different pieces of work that your applications need to do, and an easy way to describe how those pieces might be dependent upon one another. Units of work are described as blocks in your code while queues are used to organize blocks based on how you believe they need to be executed. By using blocks and queues, you no longer need to worry about threads. ... You can simply let the system manage the work queues and execute the blocks for optimal performance".
Boy... Whew... these white papers sure have a way of making things sound simple.... Ahem....
To the white paper writer's credit I only remember seeing the word 'simple' in the white paper a few times (although it is implied throughout). I always get worried when I see the word simple and parallel programming so easily juxtaposed. This is what me and Tracey are initially concerned about. The software development community just spent the last decade or so moving away from procedural and unit-of-work module decompositions toward object-oriented and agent architectures (we won't mention service oriented architectures here). The basic module is now represented by a noun as opposed to a verb. As a industry we have (for the most part swallowed) the object-oriented paradigm pill. At the design level we now think of software in terms of the objects it consists of and the methods those objects export. It wasn't immediately apparent in the Grand Central Dispatch white paper how the blocks and queue decomposition fits in with object-oriented decomposition but then again as I said at the start we haven't RTM yet so we don't want to jump to conclusions.
We're excited that Apple has offered to solve our multicore programming woes. We're down right appreciative! What a wonderful gift horse it is. But we've come to far with object-oriented and agent-oriented architectures to turn back to a procedural-based framework approach. We hope that this is not the case with GCD. We'll keep you posted.