Fake threads (was [Python-Dev] ActiveState & fork & Perl)

Gordon McMillan gmcm@hypernet.com
Sat, 3 Jul 1999 22:41:32 -0500


Hmmm. I jumped back into this one, but never saw my post show up...

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.

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

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.


- Gordon