Apple open sources Grand Central Dispatch – libdispatch

September 11, 2009
By

Apple has open sourced Grand Central Dispatch, a new technology added in MAC OS X 10.6 Snow Leopard that  for developers to take make effective use of multi-core parallelism. It is also called libdispatch, and the source code is available at http://libdispatch.macosforge.org/.  This move comes as a surprise to many because it is a core technology in Snow Leopard, which gives Apple a leg up in multi-core parallelism. 0 

The libdispatch project consists of the user space implementation of the Grand Central Dispatch API as seen in Mac OS X version 10.6 Snow Leopard. The Mac OS X kernel support for GCD may be found in the xnu project. The Grand Central Dispatch open source code include only the developer APIs, not the kernel support. The kernel support will need to be rewritten for each platform. While kernel support provides many performance optimizations on Mac OS X, it is not strictly required for portability to other platforms. However, in order to implement the full API for Grand Central Dispatch, C compiler support for blocks is required. The blocks runtime is available as part of the LLVM project. The sources are available under the terms of the Apache License, Version 2.0 in the hope that they might serve as a launching point for porting GCD to other platforms.

The libdispatch open source project is intended to be a resource for developers interested in learning more about libdispatch on Mac OS X. Apple will be continually evaluating developer contributions for possible inclusion in future releases of Mac OS X.  This may be one of the motivation in open sourcing libdispatch.

The open source project opens the door to porting Grand Central to be ported to other UNIX/Linux systems, which will spread the usage of libdispatch, including having Grand Central Dispatch incorporated in command line tools. Before this open source move, developing UNIX tools on MAC OS X using Grand Central Dispatch would have been very unlikely because that would mean it can only be run on a MAC. 0 

The libdispatch open source project also opens up many possibilities for academic researchers working on parallel processing, and possibly porting the code to supercomputers and cloud computing.

Grand Central Dispatch uses another Apple technology – blocks, which are an extension to C.  Apple may be hoping that the spread of libdispatch would drive the adoption of blocks in C. There are not may choices of C compilers that support blocks. Apple mayy need to release its C compiler in the future to support blocks.

This is a great move for the developer and research community and will likely benefit Apple greatly in return.

One Response to Apple open sources Grand Central Dispatch – libdispatch

  1. Apple geeft broncode vrij | Techfreak on September 15, 2009 at 1:55 pm

    [...] Om GCD door een zo breed mogelijk ontwikke­laars­gilde geac­cepteerd te kri­j­gen, heeft Apple besloten de bron­code ervan vrij te geven onder de Apache 2.0-licentie. Met behulp van de bron­code kan de [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*