1. Computing & Technology

Discuss in my forum

David Bolton

Grand Central Dispatch - Simplifying Multi-Core Programming

By , About.com GuideSeptember 11, 2009

Follow me on:

Last week I paid for an update to my Mac Mini recently in the shape of Snow Leopard. This is a significant but not that major a release to the Leopard Mac OS X 10.5 (up to 10.6), with most improvements under the hood in improved performance, reduced footprint for non PowerPC Macs, OpenCL and Grand Central Dispatch.(GCD).

GCD is a new approach to coding on multi-core CPUs that simplifies writing code that uses all of the CPUs. it uses a new feature in Objective C (and I think eventually C) is Blocks where a section of code is marked using ^, i.e. it's effectively the same as an anonymous function. This marked block is then run in parallel on a different CPU, with optional synchronization to the main thread, perhaps if the main thread is doing GUI updates which can only be done in the main thread.

Interestingly enough, the user space implementation of GCD has been open sourced in the library libdispatch and is available on macosforge.org licensed under the Apache version 2.0 License. Note this code is C (not Objective C) but it must support Blocks in the C compiler e.g. Clang.

Comments
No comments yet.  Leave a Comment
Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2012 About.com. All rights reserved.

A part of The New York Times Company.