Apple Open Sources Snow Leopard's Grand Central Dispatch (Apple Insider)
Apple Open Sources Snow Leopard's Grand Central Dispatch (Apple Insider)
Posted Sep 13, 2009 22:58 UTC (Sun) by mikov (guest, #33179)In reply to: Apple Open Sources Snow Leopard's Grand Central Dispatch (Apple Insider) by malor
Parent article: Apple Open Sources Snow Leopard's Grand Central Dispatch (Apple Insider)
I don't think it is that clear cut. What happens for example if one task in GCD blocks on slow IO?
The kernel scheduler is in a much better position to arbitrate the available CPU resources. In theory a context switch between threads should not be much less efficient that switching between tasks.
In short, this seems mainly an attempt to work around the heavyweight and relatively inefficient threads in Mac.
OTOH, I think blocks (or closures in C) are very nice. They do not violate the spirit of C. I would love to see them in mainstream GCC.
