Re: Isn't STM good at building an ant colony?

2010-09-22 Thread Per Vognsen
If you have a fixed cell topology, you can also find a coloring of the graph and use it for contention-free scheduling. With a regular grid, you can use the obvious 2-coloring (a checkerboard pattern), so you would handle all the white squares in phase 1 and all the black squares in phase 2. -Per

Re: Isn't STM good at building an ant colony?

2010-09-21 Thread Hozumi
Hi Nicolas, That is a nice idea! Thanks. -- Takahiro Hozumi -- 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

Re: Isn't STM good at building an ant colony?

2010-09-20 Thread Nicolas Oury
If you have a fixed geometry of cells, it is quite easy to have one ref per cell. Which reduce a lot of contention. For example, on a grid where ant can go instead of representing the world as a ref to a matrix, you can represent the world as a matrix of refs. Those refs can then be update

Isn't STM good at building an ant colony?

2010-09-19 Thread Hozumi
Hi. I posted following question. The more threads that changes the Clojure's ref are, the more does the rate of retries per threads rise? http://stackoverflow.com/questions/3746893/the-more-threads-that-changes-the-clojures-ref-are-the-more-does-the-rate-of-re I think increasing retries in