On 17 Dec 2010, at 19:47, nicolas.o...@gmail.com wrote:

How about futures? They are in clojure.core and can be used for much the same purposes as Fork/Join, unless your individual tasks are so small that the performance advantage of Fork/Join makes a difference.


Thank you for this suggestion. I thought a bit, and I wonder whether
it can result in too many thread being forked or thread starvation
deadlock in my situation.

Does future fork a thread per task?

A future is submitted to the same thread pool used by send-off for agents. This is a thread pool of unlimited size, so there is in principle a risk of many threads being started if you run futures faster then they can finish, or if many of them end up blocking. If you use a recursive-decomposition approach, fork/join is likely to be a better choice because it was designed for that kind of pattern. But there is no risk of deadlock or thread starvation.

Konrad.

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