From: Ned Konz Date: 2001-11-02T09:46:25+09:00 Subject: [ruby-talk:24131] Re: cost of threads vs. continuations On Thursday 01 November 2001 04:41 pm, Avi Bryant wrote: > How different are the costs of a continuation and a suspended thread? It > seems like they ought to be almost identical, but is there anything in the > internals that makes one preferable to the other? Is it reasonable to > have, say, a hundred or even a few hundred active threads or continuations > at once? I thought continuations were implemented using threads. > I'm playing with extending iowa to allow web apps written in something > like a continuation-passing style (normally, passing control to another > page is much like a goto, and I want to allow something that looks like > a subroutine call), and although the idea is most naturally expressed > using call/cc it may be hackable with threads instead. Of course, if > continuations are cheaper, then I won't bother. ;-) Another possibility might be to use futures (what Smalltalk often calls a Promise); this gives you reasonably transparent thread synchronization. With Ruby's join() method, it's easy to implement as well. -- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com