One of my pet study areas is programming paradigms, something I've done since my university days looking at SmallTalk (object-orientation) and Ada (safety critical). The next great next battle line is how to take advantage of multi-core machines to do parallel computing without blowing our poor programmer minds. Intel is doing a lot of work in this area and it's really interesting that Apple is doing the same. I'm not sure why, but good on them.
The two technologies that seem to have sprouted from them and are supported in Snow Leopard are OpenCL, the Khronos standard for mixed GPU/CPU computing, and Apple's Grand Central Dispatch, a task parallelism extension to C, C++, and Objective-C with something called Blocks. There is a recent report from Hardmac.com that shows some real significant improvement form these technologies.
I don't know much about either, but this is definitely something I'm adding to my reading list for those nights I can't get to sleep (which if you're following me on twitter you'll notice are happen regularly).
I dunno... I can't really see this being a tool for the masses. Open source or no, I suspect it's too tightly coupled to Apple's compiler extensions to port nicely. Intel's TBB look more promising, and I gather (though I'm fuzzy on the details) that it could layer on top of GCD where available.
ReplyDeleteIncidentally, re blocks, there was an informative thread on clc++m a while back comparing them to C++0x lambdas:
http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/f6479d0d4dab8592?pli=1
You might want to check out John Siracusa's Snow Leopard review. He has a pretty good overview of LLVM, Clang, GCD, and blocks: http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/9
ReplyDeleteI like the new block type, since it is available in C, C++ and Objective-C. And I also like the idea of a higher instance ;-) in Mac OS X , that knows much more about the system load, and therefore scheduling decisions, than my local pogram.
ReplyDeleteNow how do you model/design/tailor/test your code to really make use of these new constructs?
Are these blocks & queues (=message boxes) useful for Actor-based languages?
P.S.: All these serial and parallel queues, event sources, semaphores and dispatch mechanisms in GCD have a strong resemblance to a railway net, track switches, etc. for me. Guess I have to look out for a train simulator :-)
P.S.: Additional info about GCD & blocks: http://www.mikeash.com/?page=pyblog