* max number of threads on a system
@ 2002-03-22 1:05 joeja
2002-03-22 5:49 ` David Schwartz
0 siblings, 1 reply; 8+ messages in thread
From: joeja @ 2002-03-22 1:05 UTC (permalink / raw)
To: linux-kernel@vger.redhat.com
What limits the number of threads one can have on a Linux system?
I have a simple program that creates an array of threads and it locks up at the creation of somewhere between 250 and 275 threads.
The program just hangs indefinately unless a Control-C is hit.
How can I increase this number or can I?
Thanks, Joe
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: max number of threads on a system
2002-03-22 1:05 max number of threads on a system joeja
@ 2002-03-22 5:49 ` David Schwartz
2002-03-22 6:02 ` Davide Libenzi
0 siblings, 1 reply; 8+ messages in thread
From: David Schwartz @ 2002-03-22 5:49 UTC (permalink / raw)
To: joeja, linux-kernel@vger.redhat.com
On Thu, 21 Mar 2002 20:05:39 -0500, joeja@mindspring.com wrote:
>What limits the number of threads one can have on a Linux system?
Common sense, one would hope.
>I have a simple program that creates an array of threads and it locks up at
>the creation of somewhere between 250 and 275 threads.
If it locks up, that's a bug. I remember older versions of glibc actually
had this bug. But it should simply fail to create them.
>The program just hangs indefinately unless a Control-C is hit.
>
>How can I increase this number or can I?
Why increase the number of threads you can create before you trigger a bug?
Wouldn't it make more sense to *fix* the bug so that pthread_create returns
an error like it's supposed to?
In any event, don't create so many threads. Create threads only to keep CPUs
busy or to pend I/Os that can't be done asynchronously.
DS
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: max number of threads on a system
2002-03-22 5:49 ` David Schwartz
@ 2002-03-22 6:02 ` Davide Libenzi
2002-03-22 15:34 ` Bill Davidsen
0 siblings, 1 reply; 8+ messages in thread
From: Davide Libenzi @ 2002-03-22 6:02 UTC (permalink / raw)
To: David Schwartz; +Cc: joeja, linux-kernel@vger.redhat.com
On Thu, 21 Mar 2002, David Schwartz wrote:
>
>
> On Thu, 21 Mar 2002 20:05:39 -0500, joeja@mindspring.com wrote:
> >What limits the number of threads one can have on a Linux system?
>
> Common sense, one would hope.
>
> >I have a simple program that creates an array of threads and it locks up at
> >the creation of somewhere between 250 and 275 threads.
$ ulimit -u
- Davide
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: max number of threads on a system
2002-03-22 6:02 ` Davide Libenzi
@ 2002-03-22 15:34 ` Bill Davidsen
2002-03-22 15:42 ` James Bourne
2002-03-22 17:35 ` Davide Libenzi
0 siblings, 2 replies; 8+ messages in thread
From: Bill Davidsen @ 2002-03-22 15:34 UTC (permalink / raw)
To: Davide Libenzi; +Cc: David Schwartz, joeja, linux-kernel@vger.redhat.com
On Thu, 21 Mar 2002, Davide Libenzi wrote:
> On Thu, 21 Mar 2002, David Schwartz wrote:
>
> >
> >
> > On Thu, 21 Mar 2002 20:05:39 -0500, joeja@mindspring.com wrote:
> > >What limits the number of threads one can have on a Linux system?
> >
> > Common sense, one would hope.
> >
> > >I have a simple program that creates an array of threads and it locks up at
> > >the creation of somewhere between 250 and 275 threads.
>
> $ ulimit -u
/proc/sys/kernel/threads-max is the system limit. And "locks up" is odd
unless the application is really poorly written to handle errors. Should
time out and whine ;-)
--
bill davidsen <davidsen@tmr.com>
CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: max number of threads on a system
2002-03-22 15:34 ` Bill Davidsen
@ 2002-03-22 15:42 ` James Bourne
2002-03-23 3:14 ` Bill Davidsen
2002-03-22 17:35 ` Davide Libenzi
1 sibling, 1 reply; 8+ messages in thread
From: James Bourne @ 2002-03-22 15:42 UTC (permalink / raw)
To: Bill Davidsen
Cc: Davide Libenzi, David Schwartz, joeja,
linux-kernel@vger.redhat.com
On Fri, 22 Mar 2002, Bill Davidsen wrote:
> On Thu, 21 Mar 2002, Davide Libenzi wrote:
>
> > On Thu, 21 Mar 2002, David Schwartz wrote:
> >
> > >
> > >
> > > On Thu, 21 Mar 2002 20:05:39 -0500, joeja@mindspring.com wrote:
> > > >What limits the number of threads one can have on a Linux system?
> > >
> > > Common sense, one would hope.
> > >
> > > >I have a simple program that creates an array of threads and it locks up at
> > > >the creation of somewhere between 250 and 275 threads.
> >
> > $ ulimit -u
>
> /proc/sys/kernel/threads-max is the system limit. And "locks up" is odd
> unless the application is really poorly written to handle errors. Should
> time out and whine ;-)
One thing to note here, using pthreads there is a limit of 1024
threads per process. There are patches to glibc to increase this
to a larger number (4096 or 8192).
Regards
James Bourne
--
James Bourne, Supervisor Data Centre Operations
Mount Royal College, Calgary, AB, CA
www.mtroyal.ab.ca
******************************************************************************
This communication is intended for the use of the recipient to which it is
addressed, and may contain confidential, personal, and or privileged
information. Please contact the sender immediately if you are not the
intended recipient of this communication, and do not copy, distribute, or
take action relying on it. Any communication received in error, or
subsequent reply, should be deleted or destroyed.
******************************************************************************
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: max number of threads on a system
2002-03-22 15:34 ` Bill Davidsen
2002-03-22 15:42 ` James Bourne
@ 2002-03-22 17:35 ` Davide Libenzi
1 sibling, 0 replies; 8+ messages in thread
From: Davide Libenzi @ 2002-03-22 17:35 UTC (permalink / raw)
To: Bill Davidsen; +Cc: David Schwartz, joeja, linux-kernel@vger.redhat.com
On Fri, 22 Mar 2002, Bill Davidsen wrote:
> On Thu, 21 Mar 2002, Davide Libenzi wrote:
>
> > On Thu, 21 Mar 2002, David Schwartz wrote:
> >
> > >
> > >
> > > On Thu, 21 Mar 2002 20:05:39 -0500, joeja@mindspring.com wrote:
> > > >What limits the number of threads one can have on a Linux system?
> > >
> > > Common sense, one would hope.
> > >
> > > >I have a simple program that creates an array of threads and it locks up at
> > > >the creation of somewhere between 250 and 275 threads.
> >
> > $ ulimit -u
>
> /proc/sys/kernel/threads-max is the system limit. And "locks up" is odd
> unless the application is really poorly written to handle errors. Should
> time out and whine ;-)
Around 250 was the old limit for max user processes ( non root ), if i
remember well.
- Davide
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: max number of threads on a system
2002-03-22 15:42 ` James Bourne
@ 2002-03-23 3:14 ` Bill Davidsen
2002-03-25 9:10 ` Peter Wächtler
0 siblings, 1 reply; 8+ messages in thread
From: Bill Davidsen @ 2002-03-23 3:14 UTC (permalink / raw)
To: James Bourne
Cc: Davide Libenzi, David Schwartz, joeja,
linux-kernel@vger.redhat.com
On Fri, 22 Mar 2002, James Bourne wrote:
> One thing to note here, using pthreads there is a limit of 1024
> threads per process. There are patches to glibc to increase this
> to a larger number (4096 or 8192).
Haven't checked to see the limit in NGPT, but I haven't hit it ;-)
--
bill davidsen <davidsen@tmr.com>
CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: max number of threads on a system
2002-03-23 3:14 ` Bill Davidsen
@ 2002-03-25 9:10 ` Peter Wächtler
0 siblings, 0 replies; 8+ messages in thread
From: Peter Wächtler @ 2002-03-25 9:10 UTC (permalink / raw)
To: Bill Davidsen
Cc: James Bourne, Davide Libenzi, David Schwartz, joeja,
linux-kernel@vger.redhat.com
Bill Davidsen wrote:
> On Fri, 22 Mar 2002, James Bourne wrote:
>
>
>>One thing to note here, using pthreads there is a limit of 1024
>>threads per process. There are patches to glibc to increase this
>>to a larger number (4096 or 8192).
>>
>
> Haven't checked to see the limit in NGPT, but I haven't hit it ;-)
>
There is another limit creeping in: pthread mmap()s 2 MB
of stack for each thread. So you run out of address space
on 32 bit systems with threads > 1024 (and smaller)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-03-25 9:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-22 1:05 max number of threads on a system joeja
2002-03-22 5:49 ` David Schwartz
2002-03-22 6:02 ` Davide Libenzi
2002-03-22 15:34 ` Bill Davidsen
2002-03-22 15:42 ` James Bourne
2002-03-23 3:14 ` Bill Davidsen
2002-03-25 9:10 ` Peter Wächtler
2002-03-22 17:35 ` Davide Libenzi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox