All I need is some sort of threads that can handle 1000 simultaneous 
threads and 300,000 context switches per second. I don't actually need the 
coroutine value-passing feature; they are just one thing that lightweight 
threads can be built on top of. Regular OS threads (via java.lang.Thread) 
would work (barely), but lightweight threads would be nice. I really do 
need 1000 stacks active at a time, so actors, futures, work queues and so 
on wouldn't work. Non-expert programmers need to be able to write code 
running in these threads easily so rewriting code using monads is not a 
good option.

I'll give that delimited continuation package a try. They'd certainly work, 
it's just a question of whether paying for closure allocation or OS thread 
switches are cheaper. (This code is performance sensitive.)

I read a paper recently that described modifying the JVM to support 
lightweight threads but as you say no such modifications seem to have been 
added to the standard JVMs. The obscure JVM Avian does support 
continuations, but I need debugging support and Avian doesn't seem to have 
that yet.

I'd be happy to describe what the application is but it doesn't have much 
to do with clojure (I haven't decided whether or not to use clojure yet) so 
if you want to know more please email me off list.

Thanks for your help.

ws

On Wednesday, September 26, 2012 4:50:15 AM UTC-4, Nicolas Oury wrote:
>
> No continuations or coroutines support on the JVM, as far as I know. 
> However, there are a few monad libraries for clojure with which you 
> would probably 
>  be able to do what you want. (Using the continuation monad...) 
> http://www.intensivesystems.net/tutorials/monads_101.html , for example. 
>
> Delimited continuations also allows to mimic coroutines (and more). 
> There is this: 
>
> https://github.com/swannodette/delimc 
>
> There is another slight problem: the JVM do not have proper tail 
> recursions which makes 
> working with continuations trickier. 
> So you should know about trampolining. 
> http://pramode.net/clojure/2010/05/08/clojure-trampoline/ 
>
> The best thing would be to tell us what you want to use coroutines for 
> and we could answer better on 
> what would be the best choice in clojure. 
>

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