On Fri, Jan 27, 2006 at 08:06:59AM -0500, David Zakar wrote: > Is there a maximum number of threads I can spawn in a program using > pthread_create() in Linux? I've noticed that once I exceed 300 or so, it > appears to just refuse to create new threads.
You need to shrink the max stack per thread with setrlimit(). Basically, default max stack size is : [EMAIL PROTECTED]:~/swork/sidecar> limit stacksize stacksize 10240 kbytes and the max number of threads, n, is such that n*10k is less than the 2GB user space addressible space. Each thread doesn't use all of the stack space at once (it dynamically grows with each thread), but it ensures that the max is available before letting you create the thread. - Rob .
