Thread Starvation

Humphreys, Brett bretth at
Tue Sep 14 15:40:59 CEST 2004

Hello All,

To preface my question, I'm running python on an embedded PowerPC chip
(8xx), with a host OS of Linux.  I'm seeing, in some of my applications,
thread starvation.  I can create new threads, however their run methods
are never called.  Interestingly enough, threading.activeCount() and
threading.enumerate() properly return all the threads I've started.  Yet
none of them will get their run method called.  

The python interpreter we use to run our python scripts is created
programmatically in its own thread (f that matters at all).  

For quite sometime, I thought this was a memory leak on our side, but
I'm not convinced of that, yet I haven't ruled it out.  If it is a
memory leak, it only manifests itself in threading, no where else do we
see strange behavior, and we write quite a few scripts targeted to this

90% of our scripts have threads that work just fine.  It is a small
subset of our scripts that have thread starvation.  It is worth noting
that if a script runs into this problem, *all* of the threads starve,
not just a couple of them starve.

Finally, the scripts that exhibit this behavior, always exhibit this
behavior.  It doesn't seem to be dependent upon any external conditions.

What I'm curious about is the following:

- Has anyone ever encountered something similar to this?
- What are appropriate ways of debugging this?  Are there ways to debug
the interpreter to get more information from it (i.e.: what is causing
it to not call run(), is there some mutex issue, resource issue, etc)?  

I realize there are a ton of variables to take into account here, I'm
just looking for some ideas on what might be holding me up.  

Thanks so much.

Brett Humphreys
Software Engineer
Applied Innovation
Office: 800-247-9482 x2302
Fax:    614-798-1770

More information about the Python-list mailing list