threads

Alex Maranda amaranda at nospam.com
Mon Jun 7 12:32:25 CEST 1999


Steven D. Majewski wrote:
>  I recall this was one of the reasons I favored coroutines over threads --
> the explicit yield means that you don't need locks. Sort of like the
> non-preemptive multitasking on the Mac. The Mac, of course, is now
How do coroutines work on MP machines? They don't - just a reminder of
how this thread started :)

> moving towards a fully preemptive multitasking model -- which makes
> better sense for a OS because you can't control all of the code in all
> of the apps and ensure that they all behave like good citizens. However,
> in a single app, that's not a problem, and cooperative multitasking
> with coroutines is a simpler model.
I have to disagree; yielding the processor explicitely (or forgetting to
do it :) is something I can live without. And it very much depends on
what you're doing - suppose you call a blocking syscall in one coroutine
- you're handing out the CPU at least for the duration of the syscall;
not so with a (kernel) threads implementation. The limitations of the
current implementation (which really sucks only on MP machines, for a
heavy-weight app) are just that, current limitations. 

Cheers,
-- 
Alex Maranda         mailto: amaranda at spider dot com
Spider Software Ltd. Tel: +44 (0)131 4757036
Edinburgh, UK        http://members.xoom.com/Alex_Maranda
STREAMS based communications protocols for embedded systems




More information about the Python-list mailing list