After watching most of Rich's Clojure presentations over the weekend,
I found myself playing with ants.clj again on my netbook. The ant
simulation runs brilliantly on my quad-core machine at work. Not so
much on my netbook. The problem seems to be that with only a single
(hyperthreaded) core the render agent is almost constantly interrupted
by some pesky ant while attempting to snapshot the world, forcing the
render agent to automatically retry. And so, the ants run merrily
around the world, only I can't see it.

This raises a question. Clojure's refs and dosync sure are neat, but
this experience would seem to indicate that there are potential
scalability problems when combining long-running and short-running
transactions. Under load (or on a slow machine) a long-running
transaction may never get a chance to complete and may be stuck
forever retrying, burning CPU but producing no useful output. This
makes me uneasy.

I was able to get ants.clj to work reliably on my netbook by playing
around with the sleep times in such a way as to increase the
probability of the renderer actually completing a snapshot, but this
process felt hacky and ad-hoc. What works on my netbook might well be
sub-optimal on another system.

How could one change the design of ants.clj to work reliably (i.e.
update the screen periodically) even on slower systems?

// Ben

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to