thread limit question
Kevin D. Clark
kclark at CetaceanNetworks.com
Mon Jun 2 14:08:49 EDT 2003
Bryan Kate <bryankate at metrobility.com> writes:
> > Let's cut to the chase here: are you creating detached threads? Can
> > this work in your environment? Doing this would probably allow you to
> > create a lot more threads.
>
> yes, my threads are detached.
OK, good.
> > Note: if you have to create *a lot* of threads all the time, it might
> > be worthwhile to create your own thread-pool.
>
> i am creating a few pools, it is just that i need to support ALOT of
> devices, so my pools might be 100+ threads. i dont need thousands, but
> maybe more than 255...
>
> i dont see what the problem is, pthread_create returns 11 on thread 255,
> and if i do a perror on it, it just says Success... it isnt returning
> EAGAIN, indicating that i hit PTHREAD_THREADS_MAX (which is set at
> 16000+), and my ulimit on processes is 4093....
>
> i am beginning to think there is another setting somewhere (the shell or
> in login?) that allows a limitation on processes. i just cant find it.
I just wrote a little program that creates 1000 detached threads. It
runs fine on Linux. This jives with my general experience of Linux --
I can create lots of threads when I need them. "255" is not generally
a limit I am familiar with -- this is way too low.
Ideas: are you setting big thread stack sizes?
(so big that you overwhelm the stack?)
are you compiling with -D_REENTRANT and linking with -lpthread ?
Can you provide us with a small test program that exhibits this behavior?
Regards,
--kevin
--
"We have to believe in free will. We've got no choice."
--Bashevis Singer
More information about the gnhlug-discuss
mailing list