
[I jump back into a needlessly contentious thread]: [Gordon McMillan - me]
Threads (real or fake) are useful when more than one thing is "driving" your processing. It's just that in the real world (a place Tim visited, once, but didn't like - or was it vice versa?) those "drivers" are normally I/O.
[Tim]
Yes, but that's the consensus view of "real", and so suffers from "ten billion flies can't be wrong" syndrome <wink>. If you pitch a parallel system to the NSA,
I can assure you that gov't work isn't "real", even when the problem domain appears to be, which in this case is assuredly not true <wink>. But the point really is that (1) Guido's definition of "I/O" is very broad and (2) given that definition, it probably does account for 99% of the cases. Which is immaterial, if the fix for one fixes the others.
Guido complained that to do it right would require gathering up all the fds and doing a select. I don't think that's true (at least, for a decent fake thread). You just have to select on the one (to see if the I/O will work) and swap or do it accordingly. Also makes it a bit easier for portability (I thought I heard that Mac's select is limited to sockets).
Can you flesh out the "swap" part more? That is, we're in the middle of some C code, so the C stack is involved in the state that's being swapped, and under fake threads we don't have a real thread to magically capture that.
Sure - it's spelled "T I S M E R". IFRC, this whole thread started with Guido dumping cold water on the comment that perhaps Chris's work could yield green (er, "fake") threads.
I see 2 questions. First, is there enough of an audience (Mac, mostly, I think) without native threads to make them worthwhile? Second, do we want to introduce yet more possibilities for brain-explosions by enabling coroutines / continuations / generators or some such? There is practical value there (as Sam has pointed out, and I now concur, watching my C state machine grow out of control with each new client request).
I think the answer to both is probably "yes", and though they have a lot in common technically, they have totally different rationales.
a) Generators aren't enough for Sam's designs.
OK, but they're still (minorly) mind expanding for someone from the orthodox C / Python world...
b) Fake threads are roughly comparable to coroutines and continuations wrt power (depending on implementation details, continuations may be strictly most powerful, and coroutines least).
c) Christian's stackless Python can, I believe, already do full coroutines, and is close to doing full continuations. So soon we can kick the tires instead of each other <wink>.
So then we're down to Tim faking the others from whatever Chris comes up with? Sounds dandy to me! (Yah, bitch and moan Tim; you'd do it anyway...). (And yes, we're on the "dev" list; this is all experimental; so Guido can just live with being a bit uncomfortable with it <wink>). The rambling arguments have had to do with "reasons" for doing this stuff. I was just trying to point out that there are a couple valid but very different reasons: 1) Macs. 2) Sam. almost-a-palindrome-ly y'rs - Gordon