Re: Max number of threads with NPTL

Daniel Malmkvist <[email protected]>
Newsgroups gmane.comp.java.linux.general
Organization Kenet Works
Message-ID <[email protected]>
Hi

I have successfuly folowed your advise. After rekompiling the kernel so that I now can address 4G of memory, change the max #processes plus changed the thread stacksize i now can create more than 12 000 threads (which is pretty cool i thing), the limit must now be the 4G addressspace limit. I guess the next step is to buy i 64 bit platform...

Many thanks

/Daniel


On Wed, 04 Feb 2004 09:56:57 -0800
Hui Huang <[email protected]> wrote:

> Nathan Bryant wrote:
> > Daniel Malmkvist wrote:
> > 
> >> To my supprise i could not have more then ~3500 threads at the same time.
> >> I got a OutOfMemoryException, but there was plenty of system memory left
> >> (the JVM only ha about 10% of system physical memory).
> >>  
> >>
> > Address space might be a limiting factor in a 32-bit machine. Assuming a 
> > 3gig/1gig VM split, you have less than a megabyte per thread stack at 
> > 3500 threads, even assuming there is no other memory overhead, and there 
> > is a lot of other overhead... Did you try using the Thread constructor 
> > that specifies a stack size? Try specifying a single page - 4K.
> > 
> > You might also need to increase the maximum size of the Java heap. (Or 
> > decrease it to make room for more stack?) I have found that it can't 
> > grow beyond 1.5gig on x86.
> > 
> > If you are allocating the default stack size which is probably fairly 
> > large, 
> 
> Default stack size is 512k. You need 3500 * 512k = 1750M address space
> for 3500 threads. Try -Xss96k. Also check your limit on max #processes
> (ulimit -u), you can't create more threads than that limit either.
> 
> regards,
> -hui
> 
>           the system won't appear to be using the memory because the stack
> > pages won't have corresponding physical pages allocated by the VM until 
> > they are used - the stacks grow down. But they are still allocated 
> > virtual address space within the process.
> > 
> > 
> > ----------------------------------------------------------------------
> > To UNSUBSCRIBE, email to [email protected]
> > with a subject of "unsubscribe". Trouble? Contact [email protected]
> > 
> 
> 
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [email protected]
> with a subject of "unsubscribe". Trouble? Contact [email protected]
> 


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.