Affiliate Disclosure
If you buy through our links, we may get a commission. Read our ethics policy.

FreeBSD adds support for Snow Leopard's Grand Central Dispatch

Apple's Grand Central Dispatch technology, which debuted in Snow Leopard as a mechanism for optimizing parallelism across multiple cores and processors, has now been ported to FreeBSD.

Apple publicly announced plans to release its GCD technology as open source last month; the FreeBSD team demonstrated its early port of the new feature at EuroBSDCon 2009 in Cambridge, UK just days after Apple's announcement. Out of the box support for GCD is scheduled to appear with the release of FreeBSD 8.1.

The work required to port Apple's GCD event and concurrency framework to other operating systems is more complex than many other higher-level open source packages because GCD requires integration into the kernel (the core component of the operating system which manages processes, memory, and other hardware).

Most Unix-based software is highly portable between Mac OS X, Linux, and BSD, but significant kernel differences between these systems makes porting low-level, kernel-integrated technologies like GCD more work. In particular, Mac OS X uses a unique kernel design based on a hybrid of Mach and BSD. Porting GCD to FreeBSD required adaptations to account for a more conventional kernel environment without a Mach layer, such as using POSIX semaphores instead of Mach semaphores.

FreeBSD's porting efforts should help to make GCD easier to port to other operating systems with conventional Unix or Unix-like kernels, including OpenBSD, NetBSD, Linux, and Solaris.

In addition to kernel support, GCD requires compiler adaptations (a compiler is used to transform human readable source code language into the binary object code of an application). Apple's work on the Clang compiler front end and LLVM (Low Level Virtual Machine, the back end), makes porting this portion of GCD to other operating systems easier. This is particularly the case for FreeBSD, which has been quick to embrace support for Apple's Clang/LLVM open source projects.

The porting of GCD to other operating systems will help broaden the new technology's appeal. MacResearch, a website covering the use of Apple technologies in the scientific research community, observed last month that "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.”

Significant new outside interest in GCD will also likely result in a wider support base for building parallelism compatible with Apple’s other open technologies, such as OpenCL and the aforementioned Clang/LLVM compiler tools.

FreeBSD and Mac OS X

FreeBSD is a direct heir of UC Berkeley's "standard distribution" of Unix, which was created first to augment and then to replace AT&T's commercial Unix along with its expensive and closed licensing. NeXT incorporated BSD's operating system technology into its desktop workstations in the late 80s, back when using version 4.3 BSD meant licensing AT&T's Unix as well.

After BSD developers removed the vestiges of AT&T's commercial Unix code in 1991, BSD was released under a permissive license on its own; significant portions were incorporated into a wide variety of operating systems from SVR4 Unix to Windows and in many embedded applications such as network routers and firewalls. The widespread use of BSD Unix, and in particular its high quality networking code, helped to foster smooth interoperability among different vendors' products on the Internet.

In 1992, AT&T sued BSD over copyright and trademark infringement issues that were not resolved until 1994. The legal uncertainties raised by those challenges resulted a vacuum filled by Linux, which first appeared in 1991. That resulted in shifting most open source operating system development from BSD to Linux.

Apple's acquisition of NeXT at the end of 1996 resulted in Mac OS X inheriting a BSD foundation; the company had previously offered a Linux distribution (MkLinux) for its PowerPC Mac users who wanted to run an open, Unix-like environment. While open source development is still centered on Linux, Apple's move to adopt NeXT's operating system technology not only made it the world's largest Unix vendor but also shifted a significant amount of the *nix-world's attention back toward BSD.

Apple has since regularly synced its Mac OS X development roadmap to FreeBSD in its efforts to incorporate open source modernizations into what had been the aging codebase of NeXTSTEP, although the company has also borrowed technologies from other BSDs, Linux, and Sun's OpenSolaris.

The company has also contributed technology back or funded the development of projects that various open source operating systems have incorporated, including Bonjour, Clang/LLVM, CUPS (the Common Unix Printing System), and now of course GCD.