hi all,
i have a doubt in multithreading, how many threads can a java program
handle at a particular point of time.
plzzz i need the reply as soon as possible.
thanks in advance
byeee
Bart Cremers - 09 Mar 2006 11:38 GMT
Java (more precise, the JVM specification) does not specify a limit in
the number of threads. This number is limited by the underlying system.
First of all, the OS will limit the number of possible threads.
Second, there's the JVM implementation. If the JVM uses native threads,
the limit is one on one with the OS limit, of course depending on the
threads used by other processes on the system.
If the implementation uses "green" threads, you'll be limited by either
the JVM itself or the combination JVM-OS, because a number of "green"
threads can be mapped to a single native thread.
Don't know if this is all clear, but anyway; there's no fixed answer to
your question.
Regards,
Bart
Thomas Hawtin - 09 Mar 2006 17:28 GMT
> i have a doubt in multithreading, how many threads can a java program
> handle at a particular point of time.
Operating systems will often impose a limit, but the big problem for
32-bit machines is virtual address space.
Each thread has the maximum sized stack allocated in the virtual address
space. Only the first page will be physically allocated, so it's not
physical memory that is important. However if you have a 2-4 GB
addressing limit, there can be problems with the number of threads. The
stack size can be reduced with -Xss on Sun JVMs.
64-bit machines shouldn't have this problem. The VolanoMarks benchmarks
stress number of threads, so may be worth googling.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/