Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Nov 2004 21:53:07 +0000
From:      Martin Grigorov <mcgregory@e-card.bg>
To:        freebsd-java@freebsd.org
Cc:        Ronald Klop <ronald-freebsd8@klop.yi.org>
Subject:   Re: Thread's type
Message-ID:  <1100209986.683.49.camel@martin151>
In-Reply-To: <opsha1jrjw8527sy@smtp.local>
References:  <1100119160.700.13.camel@martin151> <opsha1jrjw8527sy@smtp.local>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2004-11-11 at 14:36, Ronald Klop wrote:
> On Wed, 10 Nov 2004 20:39:21 +0000, Martin Grigorov <mcgregory@e-card.bg>  
> wrote:
> 
> > Hi all,
> >
> > I want to ask what type are Java threads in FreeBSD - green or native ?
> > I'm using FreeBSD 5.3 and jdk 1.4.2 from ports, actually
> > /usr/ports/jdk14.
> >
> > I am a little bit confused: a sysctl entry
> > "kern.threads.max_threads_per_proc" says that one process can run max
> > 1500 threads. But I wrote test and it crashes with:
> > 'Exception in thread "main" java.lang.OutOfMemoryError: unable to create
> > new native thread', after starting ~ 8300 threads in the Virtual
> > Machine.
> > So it sais "native" in the exception, but they are much more than 1500.
> 
> Java uses native threads.
> 
> About the 'kern.threads.max_threads_per_proc' limit:
> The default thread support of FreeBSD 5 (libpthread) doesn't map userspace  
> threads and kernel thread 1:1.
> As long as a thread isn't executing in a part of the kernel it doesn't use  
> kernel resources.
> Use top -H to see all threads that are known to the kernel.
> 
> If you put this in /etc/libmap.conf you will use a 1:1 thread library and  
> your program will give (the expected) errors around 1500 threads.
> 
> libpthread.so.1         libthr.so.1 # Everything that uses 'libpthread'
> libpthread.so           libthr.so   # now uses libthr.
> 
> libc_r.so.5             libthr.so.1 # Everything that uses 'libc_r'
> libc_r.so               libthr.so   # now uses 'libthr'
> 
> Because the N:M thread mapping a program can switch between threads  
> without kernel overhead.
> 
> Ronald.

Hi

Thanks for the response.
Did you know how can I manage the maximum number of userland threads at
all (using libpthread library), or in my case the number of threads in
java process. I know about the option -Xss, but this sets the maximum
stack size, not the number of threads that could be started. 
Even more "man java" says that:
 "The  default  stack size is determined by the Linux
 operating system upon which the  Java  platform 
 is running."
What is the default in FreeBSD ?

Do somebody know when we will have /usr/ports/jdk15 ( or  maybe
/usr/ports/jdk5 :) )?
I have installed linux-sun-jdk15, but it crashes with SIGSYS, even when
I run it within Linux's bash2.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1100209986.683.49.camel>