Linux Maximum thread count limit and current thread count Query
1. Summary system restrictions:
/Proc/sys/kernel/pid_max # Check the maximum number of threads supported by the system, which is generally large, equivalent to the theoretical value.
/Proc/sys/kernel/thread-max
Max_user_process (ulimit-u) # The system limits the maximum number of processes or threads that a user can run.
/Proc/sys/vm/max_map_count
Hardware Memory size
2. Restrictions on java virtual machines:
-Xms # intial java heap size
-Xmx # maximum java heap size
-Xss # the stack size for each thread
3. query the number of threads or processes of a program.
Pstree-p 'ps-e | grep java | awk '{print $1} ''| wc-l
Or
Pstree-p 3660 | wc-l
4. query the number of threads or processes used by the entire system.
Pstree-p | wc-l
1,Cat/proc/$ {pid}/status
2,Pstree-p $ {pid}
3,Top-p $ {pid} and then press H or directly enter top-bH-d 3-p $ {pid}
Top-H
-H: Threads toggle
Add this option to start top, and a thread is displayed in the top row. Otherwise, a process is displayed in one row.
4. ps xH
H Show threads as if they were processes
This allows you to view all existing threads.
5. ps-mp <PID>
M Show threads after processes
In this way, you can view the number of threads started by a process.