How many threads does JAVA support at most

1. When the java thread is turned on, the default virtual machine allocates 1M of memory, but the maximum number of threads on 4G windows is more than 300, which is caused by some limitations of windows itself.

2. The memory (stack space) allocated by the virtual machine to each thread is specified by the virtual machine parameter -Xss. The default size corresponding to different platforms can be found in the official documentation of oracle:
http://docs. oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman  /optionX.html
Among them, the default Xss value of Linux 64-bit is 256K, not 1M or 10M

3. The number of threads that a Java process can start can be calculated by the following formula:

( System remaining memory - maximum heap capacity Xmx - maximum method area capacity MaxPermSize) / maximum stack space Xss In

this way, how many threads can a single process of a 4G server open can be roughly calculated, about 5000 threads.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326521713&siteId=291194637