How to increase number of threads per process?

Ronan Viernes Ronan.Viernes at onsemi.com
Wed Jul 14 04:27:21 CEST 2004


Hi Steve,

Thanks for the info. Unfortunately, adding the sleep to my previous
example (modified version below) did not alter the results. Please
take note that I am using thread library (and not threading). The
sample code below is simplified version of our system and of course
each of the thread has other tasks to do rather than staying idle in
there.

What really puzzles me now is, if I change the environment (OS and
Python Versions) accordingly it will give different results. This made
me believe that it is somewhat 'configurable'.

Anyway, I really appreciate the help. Let's wait what the others have
to say.

> > ######
> > #testThread.py
> > import thread, sys
> > 
> > def main():
> >     print "Main Thread:", thread.get_ident()
> >     count = 0;
> >     try:
> >         while 1:
> >             thread.start_new_thread(test,(`count`,))
> >             count = count + 1;
> >             if count % 10 == 0 and count != 0:
> >                 time.sleep(0.01)
> >     except:
> >         print "Total Threads:", count
> >         print "Exiting Main Thread:", thread.get_ident()
> >         raise
> > 
> > def test(input=None):
> >     print "count:", thread.get_ident(), input
> >     while 1: #keep thread alive until it breaks
> >         pass
> > 
> > if __name__ == "__main__":
> >     main()
> > 
> > #####
> > 
> > Results:
> > 
> > 1. SuSE Professional 7.1 (Kernel 2.4.18), Python 1.5.2
> >    Max Threads = 1024
> > 
> > 2. SuSE Professional 7.1 (Kernel 2.4.18), Python 2.0
> >    Max Threads = 1024
> > 
> > 3. SuSE Enterprise Server 8.0 (Kernel 2.4.18), Python 1.5.2
> >    Max Threads = 256
> > 
> > 4. SuSE Enterprise Server 8.0 (Kernel 2.4.18), Python 2.2
> >    Max Threads = 512
> > 
> > Note:
> >    For all setup, SuSE Linux threads-max=14336 and max_map_count=65536
> > 
> > Questions:
> > 1. How to determine the number of threads? Is it something
> > configurable?
> > 2. Why do the results above differ in output?
> > 3. How to increase the maximum number of threads per process?
> > 

Regards,
Ronan



More information about the Python-list mailing list