Channels ▼

James Reinders

Dr. Dobb's Bloggers

Apple's Grand Central Dispatch: Path to Multicore

June 08, 2009

Apple has taken multicore to heart with Grand Central Dispatch, a deeply ingrained capability of their Snow Leopard OS to really help with using multicore parallelism. I'm a big fan, including the fact that it is not all new.There are many sessions at WWDC (Apple's developer conference) which promise to be quite informative. Apple is really helping unlock the power of multicore processors.

What Is It?

At the heart of Grand Central Dispatch is NSOperationQueue which debuted in "Leopard" (released October 2007). Around this simple "hey, throw this work on the queue" is a commitment in the operating systems and tools to encourage its use and make it easy to access.

On Friday of this week, after attending sessions this week from Apple on Grand Central Dispatch at WWDC, I recommend not missing a session which show Grand Central Dispatch in action and comparing it with the same program using TBB.

WWDC Session 131: Scaling Performance Using Grand Central Dispatch and Intel Libraries, Friday 2:00-3:15 pm

Session 131 Abstract: Scaling the performance of your application to get the most out of a multicore Mac requires an understanding of the various tools and libraries available at your disposal. Intel engineers will demonstrate, with the help of a real-world use case, how you can employ Apple's Grand Central Dispatch, Intel's Threading Building Blocks and Intel's Performance Primitives to achieve and scalable application performance on Mac OS X.
Intel Presenters: Pallavi Mehrotra, Richard Hubbard

Pallavi and Richard have a very education talk that will make you wanting to learn even more!

Will GCD replace TBB?

No, because that's not what it's about. In fact, it may be worth porting TBB on top of GCD one day. We'll see what the TBB open source project decides. GCD is an enabling technology for applications and tools. An application can use GCD directly with great affect. Pallavi and Richard show that in their talk.

A Simple Answer?

I'd use GCD when programming in Objective-C, or TBB when programming in C++ or C. Session 131 shows that either choice can work well on Mac OS X.

A Little Deeper Answer?

TBB has more knobs, is cross-OS portable, and addresses issue specific to C++.

GCD has deep support from Apple in tools and Mac OS X, and has been well integrated into Objective-C. I'm sure this will make a fertile ground for more blogging in the future. This week, it's time to learn at WWDC.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.