+ 1
How many threads use simultaneously in java?
2 Respuestas
+ 5
That'll depend upon your computer's hardware and ability to maintain the threads. So to answer your question, however many your computer can handle. To put it into perspective, I've seen thousands of threads running simultaneously.
+ 4
When profiling servers (other lang) I'd open around 40,000 network sockets and give them threads. File handles run out after this (I think just a socket thing), so I went poking at Java to see if there were similar restrictions + follow @Netkos Ent's trail.
https://dzone.com/articles/java-what-limit-number-threads
A chart there indicates "bitness" (32/64 bit) and stack size ("ThreadStackSize=") limit the max threads...showing a range ~11K to ~32K.
Unless you're stress-testing, @Netkos's "thousands" seems good enough because...16GB virtual memory for 32K threads? Ouch.