Linux Maximum thread count limit and current thread count Query

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.