How many threads can be running at the same time

Hi!!Dows anyone knows how many Threads can be running at the same time in the JVM. I'm making a multi thread client-server app and I would like to know how much simultneous connections the JVM support. I'm using one Thread per connection.
[268 byte] By [gbalboa] at [2007-9-26 3:18:57]
# 1

some time back a friend of mine who was develping a similar application told me that she ran into problem when trying to make more than 50 connections. im not sure. personally i dont think there is a limit specified.

but is it really possible to run threads simultaneously. any any particular point of time only one thread will be executing isnt it? and it all boils down to cpu sharing right? there is good chance of me being wrong. if so kindly correct me.

G.P.

ga11 at 2007-6-29 11:33:32 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

I think by "threads running at the same time", that means the number of threads currently created, not the number of threads actively executing. It is true that one CPU can run only one thread at any particular moment, but 16 CPUs can be running 16 different threads at exactly the same time.

The main limitation to the number of threads running is that each thread needs its own stack space. If you lower the default stack space per thread (type java -X to see the option), you can run more threads.

schapel at 2007-6-29 11:33:32 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
There is also a OS/platform limitation on this.You are more likely to see this in unix than in windows. In windows the max threads per user is fairly high (64k?)On unix it is lower (1024?) To up it requires changing something in the kernel/boot configuration stuff.
jschell at 2007-6-29 11:33:32 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4

Hi, thanks to all for your answers.

I think that I made the wrong question, as you said: "that means the number of threads currently created".

I'm worry about this because my application is already online (It's a mail server -SMTP and POP3 server using ORACLE for the users database- ) and some other user post in the "multi-tread forum" that almost any JVM can only have 700 threads created at the same time, and I've never heard or read anything about this.

what you mean with the stack space (memory?)

I'm using the JavaWebServer 2.0 and a servlet to start the main Thread.

Again Thanks to all for the answers but I think that the schapel answer is the one that solve my doubt...

gbalboa at 2007-6-29 11:33:32 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 5
Each thread has a stack with a certain amount of memory allocated to it. This is the memory that stores local variables, operand stack, and return locations of the currently executing method calls in that thread.
schapel at 2007-6-29 11:33:32 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 6
Thank's for your help Steve.
gbalboa at 2007-6-29 11:33:32 > top of Java-index,Java HotSpot Virtual Machine,Specifications...