1 Jul 1999 06:30
RE: Fake threads (was ActiveState & fork & Perl)
Tim Peters <tim_one <at> email.msn.com>
1999-07-01 04:30:30 GMT
1999-07-01 04:30:30 GMT
[Guido] > I guess it's all in the perspective. 99.99% of all thread apps I've > ever written use threads primarily to overlap I/O -- if there wasn't > I/O to overlap I wouldn't use a thread. I think I share this > perspective with most of the thread community (after all, threads > originate in the OS world where they were invented as a replacement > for I/O completion routines). Different perspective indeed! Where I've been, you never used something as delicate as a thread to overlap I/O, you instead used the kernel-supported asynch Fortran I/O extensions <0.7 wink>. Those days are long gone, and I've adjusted to that. Time for you to leave the past too <wink>: by sheer numbers, most of the "thread community" *today* is to be found typing at a Windows box, where cheap & reliable threads are a core part of the programming culture. They have better ways to overlap I/O there too. Throwing explicit threads at this is like writing a recursive Fibonacci number generator in Scheme, but building the recursion yourself by hand out of explicit continuations <wink>. > ... > As far as I can tell, all the examples you give are easily done using > coroutines. Can we call whatever you're asking for coroutines instead > of fake threads? I have multiple agendas, of course. What I personally want for my own work is no more than Icon's generators, formally "semi coroutines", and easily implemented in the interpreter (although not the language) as it exists today.(Continue reading)
The assumption is that all languages will make _some_ use of the
> stack, so they ask a language to report its "stack base address"
> and "stack size". Using this information, the debugger sorts into the
> correct call sequence.
Mark, you can't *really* believe Chris is incapable of hacking around this,
right?
It's not even clear there's something to be hacked around, since Python is
only Python and there's nothing Christian can do to stop other languages
that call into Python from using the machine stack, or to call other
languages from Python without using the machine stack. So Python "shows up
on the stack" no matter what, cross-language.
> ...
> Bit I also understand completely the silence on this issue. When the
> thread started, there was much discussion about exactly what the
> hell these continuation/coroutine thingies even were.
The Fuchs paper Sam referenced explained it in simple C terms: a
continuation is exactly what C setjmp/longjmp would do if setjmp saved (&
longjmp restored) the C stack *in addition* to the program counter and
machine registers (which they already save/restore). That's all there is to
it, at heart: objects capture data state, continuations capture control
flow state. Whenever the OS services an interrupt and drops into kernel
RSS Feed