On Mar 2, 2009, at 5:15 AM, Anand Patil wrote:

>
>
>
> On Mar 1, 10:58 pm, Rich Hickey <[email protected]> wrote:
>> On Mar 1, 2009, at 1:53 PM, Anand Patil wrote:
>> I've made futures use the Agents' CachedThreadPool, which should
>> prevent the thread pool exhaustion (svn 1316). You shouldn't worry
>> about the expense of the threads, that's why there's a pool.
>>
>> Yield as you've described it is definitely not going to happen.
>
> Rich,
>
> If you'll bear with me a bit longer- what if I set breadth=1000 and
> depth=1000 in the program above. The thread pool would have to grow by
> thousands to avoid a deadlock, whereas with something like yield it
> could stay alive using only the standard, fixed-size thread pool.
>

I understand the problem and there is already a solution - it's called  
the Fork/Join framework, and you can use it easily from Clojure:

http://www.ibm.com/developerworks/java/library/j-jtp11137.html
http://gee.cs.oswego.edu/dl/concurrency-interest/index.html

I'm not going to reinvent that.

There are some wrappers for ParallelArray in clojure.parallel.  
Unfortunately it seems like ParallelArray is not going to make it into  
Java 7 (although it is still available in 'extra').

jsr166y only targets only Java 1.6+. It seems like the API is  
stabilizing though, and might be a good time to look at wrapping more  
of Fork/Join for use with Clojure (volunteers welcome).

Rich


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to