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

On Tue, Sep 21, 2010 at 9:00 PM, Hozumi fat...@googlemail.com wrote:
 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 
 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

-- 
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


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 
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


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 concurrently. Provided there are a lot
of cells and not too much contention, iti should work well.



On Sun, Sep 19, 2010 at 11:01 PM, Hozumi fat...@googlemail.com wrote:
 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 O(thread^2) means that refs should not
 be used to store the data that is aletered by too many threads like
 big ant colony map or newral network nodes.
 If modifying the data by too many threads is planned, instead of refs,
 are agents best way to store it?
 Any other solution?

 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 
 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



-- 
Sent from an IBM Model M, 15 August 1989.

-- 
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


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 O(thread^2) means that refs should not
be used to store the data that is aletered by too many threads like
big ant colony map or newral network nodes.
If modifying the data by too many threads is planned, instead of refs,
are agents best way to store it?
Any other solution?

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 
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