Linux thread limit question

Darrell Michaud <[email protected]> 06 Sep 2002 13:53:30 -0400
Newsgroups gmane.linux.ngpt.user
Message-ID <[email protected]>
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