http://images.apple.com/macosx/technolo ... 090608.pdf
Apple proposes new way to deal with multicore instead of using threads and locks.
"Grand Central Dispatch (GCD) is a revolutionary approach to multicore computing. Woven throughout the fabric of Mac OS X version 10.6 Snow Leopard, GCD combines an easy-to-use programming model with highly efficient system services to radically simplify the code needed to make best use of multiple processors.
GCD gives developers a simple way to describe the different pieces of work that your applications need to do, and an easy way to describe how those pieces might be dependent upon one another. Units of work are described as blocks in your code, while queues are used to organize blocks based on how you believe they need to be executed.
By using blocks and queues, you no longer need to worry about threads, thread managers, or locking data, making an application’s code easier to understand. You can simply let the system manage the work queues and execute the blocks for optimal performance."
More on the PDF ^^.
Any chance this might be useful?
Apple's GCD
Moderator: Ras
-
- Posts: 1260
- Joined: Sat Dec 13, 2008 7:00 pm
Re: Apple's GCD
About as useful as all other silver bullets.Nid Hogge wrote: Any chance this might be useful?
-
- Posts: 4675
- Joined: Mon Mar 13, 2006 7:43 pm
Re: Apple's GCD
Well, using a caret as a monodic operator is a new idea. Did that come from Apple, or the GCC gang? Probably the latter.
Apple's GCD will work in those cases where the dispatched threaded tasks use enough CPU time to make up for the dispatch and parameter passing overhead. So stuff that takes tens to hundreds of milliseconds or longer can be a big win overall. But for task times measured in microseconds or less (like move generation and positional evaluation), GCD just cannot work fast enough.
Anything that can be done with GCD can also be done with Posix pthreads. In fact, the underlying mechanism of GCD is almost surely based on the pthread library. What Apple developers gain is not having to learn the pthread library calls.
I hope that the optimizer bugs in g++-4.3 64 bit code generation have been fixed before this GCD stuff got added.
Apple's GCD will work in those cases where the dispatched threaded tasks use enough CPU time to make up for the dispatch and parameter passing overhead. So stuff that takes tens to hundreds of milliseconds or longer can be a big win overall. But for task times measured in microseconds or less (like move generation and positional evaluation), GCD just cannot work fast enough.
Anything that can be done with GCD can also be done with Posix pthreads. In fact, the underlying mechanism of GCD is almost surely based on the pthread library. What Apple developers gain is not having to learn the pthread library calls.
I hope that the optimizer bugs in g++-4.3 64 bit code generation have been fixed before this GCD stuff got added.
-
- Posts: 1808
- Joined: Wed Mar 08, 2006 9:19 pm
- Location: Oslo, Norway
Re: Apple's GCD
It comes from the Clang guys, who mostly work for or are funded by Apple. The first reference I have seen is this mailing list post by Chris Lattner, which is also a very good introduction to the new feature.sje wrote:Well, using a caret as a monodic operator is a new idea. Did that come from Apple, or the GCC gang? Probably the latter.
As anyone who has worked in a more civilized programming language knows, closures are tremendously useful, and not at all just another silver bullet. If this ever becomes a de facto standard implemented by all the major C/C++ compilers, I'll probably use it all over the place.
Some of the details, in particular the need to do manual reference counting in order to preserve a stack-allocated block after a function returns. Of course, ugliness like this is hard to avoid in a language without automatic GC. Overall, I'm very happy.
Tord
-
- Posts: 1822
- Joined: Thu Mar 09, 2006 11:54 pm
- Location: The Netherlands
Re: Apple's GCD
He's discussing C coding. In his post:Tord Romstad wrote:It comes from the Clang guys, who mostly work for or are funded by Apple. The first reference I have seen is this mailing list post by Chris Lattner, which is also a very good introduction to the new feature.sje wrote:Well, using a caret as a monodic operator is a new idea. Did that come from Apple, or the GCC gang? Probably the latter.
As anyone who has worked in a more civilized programming language knows, closures are tremendously useful, and not at all just another silver bullet. If this ever becomes a de facto standard implemented by all the major C/C++ compilers, I'll probably use it all over the place.
Some of the details, in particular the need to do manual reference counting in order to preserve a stack-allocated block after a function returns. Of course, ugliness like this is hard to avoid in a language without automatic GC. Overall, I'm very happy.
Tord
"The new storage class"
It's not new to me that someone who is not an imperative programmer but total addicted to object oriented programming, will never manage to get an imperative programmer.
Making now a top layer of function calls that allow embarrassingly parallel execution of a process within a single coded entity, that's not exactly new.
It does fit within a CELL model though and it is a weak redefinition of modular programming C using modules with little cohesion.