RE: Linux thread limit question

Darrell Michaud <[email protected]> 06 Sep 2002 16:42:31 -0400
Newsgroups gmane.linux.ngpt.user
Message-ID <[email protected]>
When I cat /proc/meminfo I get this:

        total:    used:    free:  shared: buffers:  cached:
Mem:  1052110848 1043681280  8429568    61440 23859200 653611008
Swap: 1069277184 11550720 1057726464
MemTotal:      1027452 kB
MemFree:          8232 kB
MemShared:          60 kB
Buffers:         23300 kB
Cached:         636404 kB
SwapCached:       1888 kB
Active:         320328 kB
Inact_dirty:    249144 kB
Inact_clean:     92180 kB
Inact_target:   262004 kB
HighTotal:      130524 kB
HighFree:         2028 kB
LowTotal:       896928 kB
LowFree:          6204 kB
SwapTotal:     1044216 kB
SwapFree:      1032936 kB

I don't see anything unusual in there, and it's strange that the thread
limit appears to be exactly 255 on every redhat 2.4.9-34 kernel and
2.4.18-10 kernel that I've tried... Very frustrating.

On Fri, 2002-09-06 at 16:22, Howell, David P wrote:
> Is there a chance that it's a virtual memory limitation? That would be a 
> prime reason for getting less than 1023, unless there is some other resource
> that is constrained.
> 
> Dave Howell
> 
> -----Original Message-----
> From: Darrell Michaud [mailto:[email protected]]
> Sent: Friday, September 06, 2002 4:01 PM
> To: Howell, David P
> Cc: [email protected]
> Subject: RE: [pthreads-users] Linux thread limit question
> 
> 
> 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