

Grand Central Dispatch Now Open to All - pohl
http://www.macresearch.org/grand-central-now-open-all

======
pohl
Drew McCormack has already posted a follow-up that goes into greater detail,
including a limited benchmark comparison to OpenMP.

[http://www.macresearch.org/cocoa-scientists-xxxi-all-
aboard-...](http://www.macresearch.org/cocoa-scientists-xxxi-all-aboard-grand-
central)

------
pohl
It will be interesting to see how the adoption of the syntax for blocks plays
out. According to the wikipedia entry for GCD, the proposed C++0x standard has
a similar concept, but uses square braces [] instead of the caret ^. The
former could be brought down to C, but Objective-C, which is defined as a
superset of C, already uses the square braces for object messaging.

Are there any C++ experts who could speak to whether there is any reason that
the caret would not work in that language?

(Edit: spelling correction)

~~~
scott_s
The C++0x feature you're referring to is for lamdas (anonymous functions). It
might be possible to use another syntax, but it would make parsing (even more
of) a nightmare because one can use "&" or "value" inside the square brackets
to indicate if values should be pass by-value or by-reference.

In practical terms, I doubt the C++ committee would change the already delayed
C++0x standard to accommodate a feature which may (but probably won't) make it
into C.

~~~
pohl
Interesting, thank you.

FWIW, it looks like the concept of a block is also an anonymous function,
although it looks as if they only allow passing into them by value, not by
reference. The developer documentation at Apple indicates that they also
support these within C++, and has a small section on how they behave within
it. So, at least, they went the extra mile and worked out the C++ parsing
issues.

[http://developer.apple.com/mac/articles/cocoa/introblocksgcd...](http://developer.apple.com/mac/articles/cocoa/introblocksgcd.html)

------
chime
I wish the headline would have been more specific and mention that this
relates to Macs. I saw this headline on my phone while waiting for my table at
a restaurant. I hurried my way back to work to sign up for it only to realize
that it was not Google Voice / Grand Central. I guess I'll have to keep
waiting for that.

~~~
pohl
Oh dear...I'm sorry about that. I copied the original headline verbatim,
because I once saw someone get flamed for not doing so. This was my first HN
submission.

~~~
edd
Modifying headlines is fine as long as you follow the Hacker News
Guidlines[1]. Just don't try and mislead people with any changes.

[1]:<http://ycombinator.com/newsguidelines.html>

------
yan
FYI, they also put up the updated XNU

~~~
pyre
The OS X/Darwin kernel for the unwashed...

------
mr_dbr
It would be nice if this was back-ported to Leopard (so you could use GCD
without the application being Snow Leopard only), I wonder how difficult this
would be..

~~~
jsz0
More than $29 worth of difficult. That's for sure.

------
grogers
How is this better than any other threadpool library?

~~~
wmf
I've found very little documentation on this, but apparently the kernel
optimizes multiple thread pools to prevent excessive context switches.
(Consider an N-core system where multiple processes each create N worker
threads of their own.)

~~~
scott_s
Do you mean process migration (rescheduling a process/thread on a different
core, which does bad things to caches) instead of context switching (switching
between different processes/threads on the same core, which requires saving
registers to memory and does bad things to caches)? If so, any decent modern
scheduler tries to avoid migrating threads.

~~~
wmf
When I said context switching I meant context switching. Now that you mention
it, GCD may also reduce thread migrations. I'm just speculating since we don't
know how GCD works.

