This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
> > >>>>> " " == Peder Chr Norgaard <pcn@tbit.dk> writes: > > > (Except that my need is not threads, but co-routines. Guile > > have threads, working fine for many purposes, thank you, but > > they are too heavyweight for this kind of work. Shortly, I > > want to "use call/cc to capture the part of the walking state > > that is on the stack"; if I can't get that to work, my > > alternative is not to use threads, but to capture the state > > explicitly - which means that I need to recode a piece of fine > > walking code to avoid use of recursion). > > The explanation which brought me closest to understand call/cc is > Dorai Sitaram's "Teach Yourself Scheme in Fixnum Days" > http://www.cs.rice.edu/~dorai/t-y-scheme/t-y-scheme.html > coroutines are among the examples presented there. Sure it looks like a well-written piece of tutorial. I'll give it a try. Thanks for the reference. > > Are you sure that call/cc is less ``heavyweight'' than threads in > Guile? I think Guile needs to copy the entire stack each time a > continuation is captured. Yes, correct, but if the stack is not deep (mine isn't) I judge this is no big deal. The cost of the guile thread is in terms of memory: each thread needs a large piece of RAM that to allow for any possible stack, both C and Scheme. That is fine for heavier things like multiplexing network traffic, for instance, but too expensive for an arbitrary data access tool. Whereas the "stack" copy of a call/cc (I think it is not truly a "copy" of the stack, just a datastructure that holds references to the bindings) is stored in the heap. --peder chr. Peder Chr. Nørgaard System Developer, M. Sc. Telebit Communications A/S tel: +45 86 28 81 77 - 49 Fabrikvej 11 fax: +45 86 28 81 86 DK-8260 Viby J Denmark e-mail: pcn@tbit.dk