Does GCD has a "global view" of all running processes?
Hi, After reading several things on GCD on the net, it is not yet clear if GCD is mainly a "per process" library, or is supposed to have a "global view" of all processes, so that to allocate "not too much" threads in each process, and avoid having a number of threads that finally exceed the number of available cores on the machine. What is the situation? Thanks Stephane Letz
On Sep 15, 2009, at 6:42 AM, Stéphane Letz wrote:
After reading several things on GCD on the net, it is not yet clear if GCD is mainly a "per process" library, or is supposed to have a "global view" of all processes, so that to allocate "not too much" threads in each process, and avoid having a number of threads that finally exceed the number of available cores on the machine.
"The net" is a notoriously unreliable source of information about, well, anything, but you're more than welcome to read the source code. It's available. :) To answer your question in brief, it's both. It's a per-process thread pool with cooperation from the kernel to determine, dynamically, how many threads should be in that pool given the overall load on the system. The kernel provides the "global view" here through the pthread_workqueue interface and a compage variable which tells libdispatch when to start retiring threads (and what the new target should be) in order to deal with a resource depletion scenario. - Jordan
What's the best place to start learning about the languages and models GCD supports? Links to public web pages are ideal. (Apologies if there's something as simple as a table of links in the README.) /r$ -- STSM, WebSphere Appliance Architect https://www.ibm.com/developerworks/mydeveloperworks/blogs/soma/
Hey Richard, In terms of languages, you've got two options for dispatching work to GCD. Either via function pointers or blocks. I would guess that with function pointers you can pretty much map any language you want onto it, bindings for perl, python, ruby, etc wouldn't be that hard. If you want to use blocks then the current implementations exist as patches on top of GCC/Clang. Even then, they've only been successfully used on Snow Leopard (and Leopard, to an extent). There are some links you can have a browse of: http://thirdcog.eu/pwcblocks/ - "Programming with C Blocks" http://www.mikeash.com/?page=pyblog/friday-qa-2008-12-26.html - Mike Ash's Blocks Q&A On top of that, it's worth reading the concurrency programming guide on ADC. Hope that helps slightly, Matt On 15 Sep 2009, at 17:41, Richard Salz wrote:
What's the best place to start learning about the languages and models GCD supports? Links to public web pages are ideal. (Apologies if there's something as simple as a table of links in the README.)
/r$
-- STSM, WebSphere Appliance Architect https://www.ibm.com/developerworks/mydeveloperworks/blogs/soma/
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
On Sep 15, 2009, at 9:41 AM, Richard Salz wrote:
What's the best place to start learning about the languages and models GCD supports? Links to public web pages are ideal. (Apologies if there's something as simple as a table of links in the README.)
I'd start with these: Overviews: http://developer.apple.com/mac/articles/cocoa/introblocksgcd.html http://developer.apple.com/mac/library/documentation/General/Conceptual/Conc... More on Blocks: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Blocks... More on GCD: http://developer.apple.com/mac/library/documentation/Performance/Reference/G... Ars Technica also covers blocks and GCD from the 10,000 foot level as part of their enormous SnowLeopard review if you're looking for a non- Apple intro. - Jordan
participants (4)
-
Jordan K. Hubbard
-
Matt Wright
-
Richard Salz
-
Stéphane Letz