Forgive the pedantry: do you mean "breathe", rather than "breath"?

On Wed, Aug 27, 2008 at 6:42 PM, Bruce Frederiksen <> wrote:
In this case, you're misunderstanding :-).

What I meant by a "long running" micro_thread starving other micro-threads, was a micro_thread that doesn't do anything that would cause it to be suspended (e.g., I/O, sleep).

For example, calculating the number PI to 2000 digits will starve other micro_threads.

Each time a micro_thread does something which causes it to be suspended (like a that needs to access the disk, a socket.recv or a time.sleep), other micro_threads may run.  So the first micro_thread doesn't cause the whole os-thread (generally the whole Python program) to be suspended, like it does now.

But if one micro_thread uses the CPU for a long time without doing any I/O, then other micro_threads are starved because micro_threads are non-preemptive (unlike os-threads).

I'm adding a "breath" function that allows responsible micro_threads to "come up for air" periodically, to give other micro_threads a chance to run.  But nothing forces a micro_thread to cooperate like this...

I hopes this helps to clear things up!


Jerry Spicklemire wrote:
Bruce wrote:

"The micro_pipes use the C_deferreds to suspend the thread
and allow other threads to run."

However, in the PEP you mention, among the short list of

"since there is no preemption, a long running micro-thread will starve other micro-threads"

Are these two point contradictory, or am I simply misunderstanding, as usual.
Python-ideas mailing list