Wats the code?

Peter Hansen peter at engcorp.com
Fri Jan 13 11:57:31 EST 2006


Kr z wrote:
> I wonder anyone knows the line of Python codes to generate 1000 threads 
> concurrently?

It's roughly the same as the line of code that generates a single new 
thread, but with an appropriate loop from 1 to 1000 around it, and 
written with a full understanding of the problems involved in creating 
massive numbers of native OS threads and the likelihood that on most 
systems this will cause an application failure of some kind.

What are you actually trying to do?  Perhaps generators, "threadlets", 
Stackless Python, or other tools will be more appropriate.  It's very 
rare to encounter a situation where 1000 threads will be a good solution 
to the problem.

-Peter




More information about the Python-list mailing list