max number of threads on a system
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/ .
Quoted 1 line · On Thu, 21 Mar 2002 20:05:39 -0500, [email protected] wrote:
What limits the number of threads one can have on a Linux system?
Common sense, one would hope.
Quoted 2 lines
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.
Quoted 3 lines
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
Quoted 9 lines · David Schwartz
Quoted 1 line · On Thu, 21 Mar 2002 20:05:39 -0500, [email protected] wrote:
What limits the number of threads one can have on a Linux system?
Common sense, one would hope.
Quoted 2 lines
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
Quoted 5 lines · Davide Libenzi
Quoted 3 lines · David Schwartz
On Thu, 21 Mar 2002 20:05:39 -0500, [email protected] wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
What limits the number of threads one can have on a Linux system?
Common sense, one would hope.
Quoted 2 lines
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 ;-)
Signature · 3 lines
bill davidsen <[email protected]> CTO, TMR Associates, Inc Doing interesting things with little computers since 1979.
Quoted 11 lines · Bill Davidsen
Quoted 9 lines · Davide Libenzi
Quoted 7 lines · David Schwartz
Quoted 1 line · On Thu, 21 Mar 2002 20:05:39 -0500, [email protected] wrote:
What limits the number of threads one can have on a Linux system?
Common sense, one would hope.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
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-maxis 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
Signature · 12 lines
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. ******************************************************************************
Quoted 3 lines · James Bourne
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 ;-)
Signature · 3 lines
bill davidsen <[email protected]> CTO, TMR Associates, Inc Doing interesting things with little computers since 1979.
Quoted 10 lines · Bill Davidsen
Quoted 4 lines · James Bourne
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)
Quoted 11 lines · Bill Davidsen
Quoted 9 lines · Davide Libenzi
Quoted 7 lines · David Schwartz
Quoted 1 line · On Thu, 21 Mar 2002 20:05:39 -0500, [email protected] wrote:
What limits the number of threads one can have on a Linux system?
Common sense, one would hope.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
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-maxis 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