RE: Linux thread limit question

Darrell Michaud <[email protected]> 06 Sep 2002 16:00:43 -0400
Newsgroups gmane.linux.ngpt.user
Message-ID <[email protected]>
This makes sense to me, but I'm wondering why I'm only getting 255
threads and not even 1023? I'd hate to go through the trouble of
patching glibc only to continue to be stuck at 255 due to some other
limitation. All the platforms I'm testing on are very stock.. I'm hoping
that someone else has seen the 255 limitation and knows where it is
coming from?

On Fri, 2002-09-06 at 14:41, Howell, David P wrote:

> For Linuxthreads the stock (unmodified library) supports 1023 threads, due
> to 
> the hard coded size for __pthread_handles in the library. I've seen it make 
> this many threads with a 'test_str02 -l'. It can be recompiled to go higher.
> I don't know where Linuxthreads binaries compiled for more threads are
> available,
> I'd check the glibc website to download the stock version and up the
> threads, 
> that was where I got the source code from.
> 
> Dave Howell
> 
> -----Original Message-----
> From: Darrell Michaud [mailto:[email protected]]
> Sent: Friday, September 06, 2002 1:54 PM
> To: [email protected]
> Subject: [pthreads-users] Linux thread limit question
> 
> 
> Hello,
> 
> I know this is a probably a FAQ, but all of the information I can find
> at http://linuxperf.nl.linux.org/ and other common linux kernel tuning
> sites only talk about 2.0 and 2.2 Linux kernels, with hardly anything
> said about 2.4
> 
> My problem is that I compiled and ran the "thread-limit.c" program from
> this site http://people.redhat.com/alikins/tuning_utils/thread-limit.c
> and it only appears to create 255 threads. Here's a sample output:
> 
>   Creating threads ...
>   Address of c = 1058258 KB
>   Address of c = 1066450 KB
>   Address of c = 1074642 KB
>   Address of c = 1082834 KB
>   Address of c = 1091026 KB
>   Address of c = 1099218 KB
>   Address of c = 1107410 KB
>   Address of c = 1115602 KB
>   Address of c = 1123794 KB
>   Address of c = 1131986 KB
>   100 threads so far ...
>   200 threads so far ...
>   Failed with return code 11 creating thread 256.
> 
> I tried compiling this test on both stock RedHat73 (2.4.18-10 kernel)
> and Redhat72 (2.4.9-34 kernel) with the same results.
> 
> - cat /proc/sys/kernel/threads-max returns "8191"
> - ulimit returns 'unlimited' or similarly high numbers in all
> catagories.
> - /etc/sysctl.conf does not have any restrictions
> - /etc/security/limits.conf does not have any restrictions 
> - I tried running the test both as root and as an unpriviledged user.
> - The sites that host the thread-limits.c file only has information
> pertaining to the 2.2 series of kernels.
> 
> Assuming that I don't want to jump to the 2.4.19 kernel and play with
> NGPT, what can I do to create more than 256 pthreads per process? Does
> anyone know what specifically needs to be changed in the kernel, and
> what specifically needs to be changed in glibc?  
> 
> Better yet, is there a trustworthy site to download prepatched binaries
> to enable more threads?
> 
> Thanks in advance
> 
> _______________________________________________
> pthreads-users mailing list
> [email protected]
> http://www-124.ibm.com/developerworks/oss/mailman/listinfo/pthreads-users