Seems to be that within linux its based on the ammount of space you allocate to the thread creation within the -Xxm settings, seems to be part of it. Thats more of a patch type thing then a fix. To get it closer to max you'll have to basically manually edit a couple of files and then recompile the program to be used.
+ max user processes (use "ulimit -u" to adjust)
+ thread limit, this is calculated based on the amount of physical memory
(you can change it by editing /proc/sys/kernel/threads-max) (this is probably the easiest way to change it)
+ virtual memory. 32bit Linux by default allows 2GB virtual address space
in user application. Unless you specify a smaller stack size (-Xss96k
will do it), java will run out of virtual space in about 4000 threads
(default stack size is 512k, 2GB/512k = 4096, but notice that the
virtual memory is also used for C heap, library image, data segments, et al.)
thoses are the various answers i have run across. Basically you modify the stack size. change the max process's as you need. And you can modify the thread count within your kernel so that it'll allow more.
to increase the limits, you have to recompile glibc. Oh fun!.
And the patch is essentially two lines!. Woohoo!
--- ./linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h.akl Mon Sep 4
19:37:42 2000
+++ ./linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Mon Sep 4
19:37:56 2000
@@ -64,7 +64,7 @@
/* The number of threads per process. */
#define _POSIX_THREAD_THREADS_MAX 64
/* This is the value this implementation supports. */
-#define PTHREAD_THREADS_MAX 1024
+#define PTHREAD_THREADS_MAX 8192
/* Maximum amount by which a process can descrease its asynchronous I/O
priority level. */
--- ./linuxthreads/internals.h.akl Mon Sep 4 19:36:58 2000
+++ ./linuxthreads/internals.h Mon Sep 4 19:37:23 2000
@@ -330,7 +330,7 @@
THREAD_SELF implementation is used, this must be a power of two and
a multiple of PAGE_SIZE. */
#ifndef STACK_SIZE
-#define STACK_SIZE (2 * 1024 * 1024)
+#define STACK_SIZE (64 * PAGE_SIZE)
#endif
/* The initial size of the thread stack. Must be a multiple of PAGE_SIZE.
* */
Now just patch glibc, rebuild, and install it. ;-> If you have a
package based system, I seriously suggest making a new package
and using it.
another way to do it.
as well here are a few links that explain it better then i can
http://www.jlinux.org/server.html (this one is the most comprehensive though and explains it all out for you

) So start here ^.^
Interestingly enough I actually found this informative, because there's no doubt times when we all hit a no more threads can be made.