The maximum number of pthreads per user is 1024. This is set in the pthread libraries. The maximum number of pthreads for the entire system can be set in proc, but it's unlikely you'd need to change this value. The way they seem to get that number is that pthread's stack space is allocated on the heap and each thread takes 2 megs of heap by default. Linux has a maximum of 2 gig heap per user, so 2meg @ 1024 give you 2 gigs of heap. If you need to increase the maximum number of threads per user, you'll need to recompile the pthread library and decrease the amount of heap per thread. This could have system wide effects, so I don't recommend it except for finely tuned application servers. It's better to re-architect your software around it or move to a different environment. Check out : http://www.jlinux.org/server.html http://www.xde.net/forum/xq/forum.56/thread.24291/qx/thread.htm Jonathan Paul Cowherd Linux and Java Administrator Genscape, Inc. Email: jonathan.cowherd@genscape.com Office: (502) 583-3730 Mobile: (502) 314-0444
-----Original Message----- From: Verdi March [mailto:cincaipatron@gmx.net] Sent: Monday, July 28, 2003 2:56 AM To: suse-programming-e@suse.com Subject: [suse-programming-e] pthread and max. number of threads
Hi,
I want to find out the maximum number of threads allowed on my machine. I repeatedly created a thread in a loop, and the result of running this small program is: thread 0 created. ... ... pthread_create error on thread 255, error code = 11
Does this error code indicate that the maximum number of threads has been reached?
How can I increase this maximum number? Does it involve ulimit? Or perhaps I need to modify the _POSIX_THREAD_THREADS_MAX and PTHREAD_THREADS_MAX definitions in /usr/include/bits/local_lim.h? Currently, they're 64 and 16384 respectively.
--
-- Verdi March --
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-> programming-e