checking a thread has started

Michael Fuhr mfuhr at fuhr.org
Mon Nov 8 01:17:50 EST 2004


Deepak Sarda <deepak.sarda at gmail.com> writes:

> The following script always works for threads less than 8. Increase it
> beyond that and it almost always fails. I say almost always because
> sometimes it manages to run. But it fails almost 98% of the time
> (unscientific observation!). The key thing is the os.system() call.
> Without that, everything works fine. Also - if I start the threads
> just after creating them - then the success rate become 98% (again -
> guess).

I wonder if you're hitting a resource limit on number of processes;
maybe your CGI environment has lower limits than your shell
environment.  Omitting os.system() would reduce the number of
processes you're running, and starting the threads immediately after
creating them would mean that some os.system() calls might finish
before others started, again reducing the number of concurrent
processes.  That's one possible explanation that fits the facts,
so let's check it out:

What do you get when you run the following script from the shell
and then as a CGI program?

#!/bin/sh
echo "Content-Type: text/plain"
echo ""
ulimit -a

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



More information about the Python-list mailing list