From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain Date: Thu, 3 Sep 2009 14:08:36 -0700 From: Roman V Shaposhnik In-reply-to: <580135a14ad078bb8223e7c448a5fa2b@quanstro.net> To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Message-id: <1252012116.16936.5128.camel@work.SFBay.Sun.COM> References: <580135a14ad078bb8223e7c448a5fa2b@quanstro.net> Subject: Re: [9fans] "Blocks" in C Topicbox-Message-UUID: 6215a32a-ead5-11e9-9d60-3106f5b1d025 On Thu, 2009-09-03 at 15:36 -0400, erik quanstrom wrote: > > > > Apple's using it all over the place in Snow Leopard, in all their native > > > > apps to write cleaner, less manual-lock code. At least, that's the claim > > > > :-). > > > > > > could someone explain this to me? i'm just missing how > > > naming a block of code could change its locking properties. > > > > > > > > The explanation is in the manual I linked to earlier in this discussion. If > > you want to see examples there's two I can think of available for download. > > One is called DispatchLife the other is DispatchFractal. > > > > I've looked at DispatchLife, and there's no explicit locking of state for > > every cell being concurrently update in Conway's game of life. > > i can't find DispatchLife after a few minutes of googling. > i've read the manual, and it looks like csp to me. clearly > i am a reprobate outside the apple reality distortion field. > > could you explain why this isn't csp Please define what is it that you refer to as csp. The reason I'm asking is simple: csp-like things are needed but *not* sufficient for implementing a nice abstraction for the parallel framework. > and why this can't be done > with regular c (that is why we need the concept of an > unnamed function pointer) and the thread library? Anything can be done using regular C and threads. The trick here is to make everything *scalable* and *painless* enough so that mere mortals can start benefiting from parallelism in their code. The other trick here is to find a model that makes things *natural*, and that means practically no explicit locking, less shared state, etc. The search for the model is meaningless unless it is used for solving *practical* challenges. In that respect, one of my favorite article is how implementation of a chess engine influenced Cilk framework (which almost has the notion of a "block") http://supertech.csail.mit.edu/papers/icca99.pdf Read it, I don't think we can be on the same page (and escape the armchair philosophy trap) unless we are talking about practical applications of the framework. Look at the chess example -- can the same be done with pure C? Sure! Did Cilk make it less painful? Absolutely! Thanks, Roman.