Running with -classic with the Sun jdk1.3.1 uses green threads and allows
the Threads example to run. On my RedHat 7.1 2.4.3-12 kernel using native
threads the test fails at about 940 threads. With -classic I can get upto
just
about any number. I tried 5000 threads and had no problem.

Now as to what is actually limiting the number of threads, I grabbed the
latest 1.3.1 beta source which is available from here:
http://developer.java.sun.com/developer/products/java2cs/
and looked into what causes the limit. The native threads code is using
the pthreads library for linux and the man page for pthread_create says
EAGAIN is thrown when more than PTHREAD_THREADS_MAX threads
are already active. On this system PTHREAD_THREADS_MAX is:

src 1082>grep -r PTHREAD_THREADS_MAX /usr/include
/usr/include/bits/local_lim.h:#define PTHREAD_THREADS_MAX       1024

I have an older linux box running RedHat 6.1 with a 2.2.16-3 kernal and it
gets to around 910 threads and also has PTHREAD_THREADS_MAX defined
to be 1024, so I would say its your pthreads lib is limiting your threads.

On the 2.2.16-3 kernel I have /lib/libpthread-0.8.so
On the 2.4.3-12 kernel I have /lib/libpthread-0.9.so


----- Original Message -----
From: "Chris Kimpton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 29, 2001 1:41 PM
Subject: [JBoss-dev] [OT] Java, threads and Linux... with jbosstest...


> Hi,
>
> When running the jbosstest's on my linux/2.2.14/sun jdk1.3.1 box I
> occasionally get the error:
>
> Exception in thread "main" java.lang.OutOfMemoryError: unable
> to create new native thread
>         at java.lang.Thread.start(Native Method)
>         at Threads.main(Threads.java:19)
>
> I am assuming that this error is due to hitting the per user process
> limit.  The box returns the following from ulimit -a
>
> core file size (blocks)     0
> data seg size (kbytes)      unlimited
> file size (blocks)          unlimited
> max locked memory (kbytes)  unlimited
> max memory size (kbytes)    unlimited
> open files                  1024
> pipe size (512 bytes)       8
> stack size (kbytes)         unlimited
> cpu time (seconds)          unlimited
> max user processes          256
> virtual memory (kbytes)     unlimited
>
> From which I would think that there is a limit of 256 processes per
> user.
>
> When running the attached test program, ( java Threads 1000 60 ), it
> gives the error when creating the 104th or so thread...
>
> On my home machine, with the same kernel, I get 245 threads
> created...
>
> I've tried recompiling the kernel to set the max procs to 4000.
>
> But the limit it then hits is around 893 threads...
>
> Of course, my win2k has no problem at all ;-)
>
> Does anyone know the most the threads that the jbosstest is likely to
> create in the server?  in the client?
>
> And why I am getting such high differences in the limits on similar
> machines?
>
> And mainly, why the maximum limit seems to be around 893?  Not the
> 4000 that should be available?
>
> I've tried playing with the memory settings, but they seem to have no
> effect, no matter how much memory I give the jvm.
>
> Thanks for any help,
> Chris
>
> PS The IBM jdk seems to have the same limit - but just does NOT give
> an error!  The blackdown/green threads jvm handles things without a
problem...
>
> =====
> Need somewhere to Live in London - http://freeflats.com
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to