Apple today made the source code of Grand Central Dispatch available under an Apache open source license. One of the new technologies for concurrency added to Mac OS X 10.6 Snow Leopard, Grand Central is Apple’s attempt to help developers deal with the rise of multi-core. The open sourcing of Grand Central comes as something of a surprise, because it is a core technology in Snow Leopard, and could be seen to give Apple a competitive edge in the new world of multi-core.
So why did they do it? Only Apple knows for sure, but there are compelling arguments for open sourcing Grand Central Dispatch, even for a commercial enterprise. First, Apple will of course reap the rewards of any development that takes place, just as they have with WebKit. Second, it is unlikely that Grand Central would be used by any direct competitor to Apple, like Microsoft. Grand Central is more likely to be added to other UNIX and Linux systems, none of which really pose a threat to Apple’s consumer-based business.
This leads to what is perhaps a more important consideration for Apple, that allowing Grand Central to be ported to other UNIX/Linux systems will encourage its use. Until today, it would have been very unlikely that any new UNIX tools would be developed on Mac OS X using Grand Central, simply because they would only run on the Mac. With the possibility that Grand Central will become available on other UNIX systems, the likelihood that Grand Central will be incorporated into command line tools is greatly increased.
Of course, this is also very interesting for scientific developers. It may be possible to parallelize code in the not too distant future using Grand Central Dispatch, and run that code not only on Macs, but also on clusters and supercomputers.
There could be one last reason why Apple has taken this step: they want to use Grand Central to push the adoption of other technologies, in particular, blocks. Blocks are an extension to C which form the basis of Grand Central Dispatch. Having your operating system based on a non-standard language is not a good position to be in, and Apple would surely like to see blocks incorporated into the C language. By offering Grand Central to the broader programming community, they may be hoping it will catch on, and make the argument for incorporating blocks in the C standard that much stronger.
All of this is in the future, and it may be some time before any of it comes to be. For a start, the Grand Central Dispatch code that has been released is only the developer APIs, not the kernel support, which would need to be rewritten for each platform. C compilers that support blocks are also in short supply, though presumably Apple will release its changes to GCC at some point, as required by the GPL.
In any case, this is an exciting move, particularly for scientific developers. If Grand Central Dispatch does catch on, it could provide a genuine option for code parallelization on and off the Mac.