February 16, 2007

Croquet system overview

Since distributed and parallel systems and concurrency are on my mind a lot, I thought I would start sharing what I consider to be the "things worth reading" about those topics through this blog (as much as for your benefit, my numerous readers, as it is to help me form my thoughts by committing them (pun fully intended) to blog posts).

To start off is some light reading about the design of Croquet: http://www.croquetconsortium.org/index.php/System_Overview

I think the key things to note about Croquet is how Reed's multi-version timestamping (I plan to make David P. Reed's PhD dissertation a future topic) is applied to messages and extended with the notion of pseudo-real time, how replication of computation is not only seen as not bad but essential to the system, and how actions are performed through a sort of delayed message passing (where the programmer uses the above-mentioned pseudo-real time scheme to specify the delay), which is called "temporal tail recursion." Notice that none of the above features are really orthogonal - none of them would work very well (or at all) by themselves. This is probably the most coherent and well-thought out model for handling time in an interactive distributed system that's out there right now.

Another lesson from Croquet is that security in an open distributed system with mobile code can be handled elegantly at the language instead of the virtual machine level. A powerful example is the fact that temporal tail recursion guarantees that malicious objects cannot go into infinite loops that suck up all computational resources. In Smalltalk all iteration is expressed explicitly as message passing, so there is nothing lost by restricting iteration to temporal tail recursion. This is a demonstration of both the benefits of powerful, uniform paradigms in programming languages, and that of the actor/functional programming paradigm specifically.


Anonymous said...

So implementing Croquet in Lisp would be a bit of a non-starter, then? ;) Or could you write something in Lisp that had enough of the crucial features of Smalltalk to give you Croquet, but which didn't have to live in its own pocket universe to quite the same extent?

P.S. Speaking of "how hard could it be", could ParenScript be extended to target ActionScript 3, or would that require a fork?


John :^P

Vladimir Sedach said...

I think it would be easier implementing a Lisp in Squeak (which has already been done: http://www.zogotounga.net/comp/squeak/lispkit.htm) rather than Croquet in Lisp. I mean if you wanted 100% compatibility then you'd need to implement Squeak in Lisp. If you wanted a Croquet-like system in Lisp, that's also a lot of work.

The way I'd go about doing that is take Scheme (maybe without call/cc, I'm not sure how that would impact things) as the "Croquet language" and use the multithreading-via-CPS technique to do the temporal recursion (in place of the thread switching).

ActionScript support has been brought up a few times. There's no reason it can't be done - it just seems no one is interested in doing it. Parenscript already targets different versions of JavaScript (you can set which one via *js-target-version*). The big change I'm planning to do - put the Parenscript printer into a separate project and have Parenscript generate a well-specified s-exp JS notation that the printer consumes - should make ActionScript support even easier to add.

synchromesh said...

I appreciate your argument; I'm currently trying to use ABCL rather than Clojure on the JVM so that I don't have to port ParenScript. ;)

It's just that I'm trying to work on my Lisp-fu rather than diversifying into other (albeit equally worthy) languages. And Common Lisp seems to me to be much more of a "real-world" language than Squeak. But obviously the sheer volume of work involved is usually the determining factor. (And I'm basically daydreaming, anyway.)

Thanks for the pointer(s). And your "separate PS printer" idea does indeed sound like the way to go.

Back to the "day job" now (which mercifully is CL!).

synchromesh said...

Meanwhile, I have come across Croqodile (http://code.google.com/p/croqodile/), "an AS3/Erlang implementation of the Croquet project's TeaTime protocol." Via Howard Stearns (http://www.wetmachine.com/item/1466) - "[a]t Qwaq we now have some pretty serious financial institutions using Croquet, but so far only for enabling interactions between people. I can't wait until they start using the model for coordinating financial transactions."

Vladimir Sedach said...

Thanks for the link to Croqodile!