Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux System Getting Started Learning: Statistical process a number of threads in Linux     - Linux / Unix desktops interesting: Christmas tree on the terminal (Linux)

- The correct way to open Xcode - Debugging (Programming)

- Install Ubuntu text editor KKEdit 0.2.10 (Linux)

- Learning MySQL data types (Database)

- Using Vagrant create cross-platform development environment (Linux)

- How screenshots from the Linux command line (Linux)

- Linux memory Cache Analysis (Linux)

- CentOS 7 install Hadoop-cdh-2.5 on Mesos (Server)

- Use UDEV SCSI Rules configured ASM on Oracle Linux 5 and 6 (Database)

- ThinkPad X220 Ubuntu 14.10 installed on fingerprint recognition (Linux)

- How to use Monit to deploy a server to monitor the system (Server)

- Two alert log ORA Errors (Database)

- Specifies the open ports of the SUSE firewall settings (Linux)

- Linux file system data file deletion problem space is not freed (Database)

- 5 interesting Linux command line tips (Linux)

- Python programmers most often committed ten errors (Programming)

- Try to use Lets Encrypt (Linux)

- Eclipse configuration GTK (Linux)

- Vim useful plugin: YouCompleteMe (Linux)

- JavaScript common functions summary (Programming)

  Linux System Getting Started Learning: Statistical process a number of threads in Linux
  Add Date : 2016-04-30      
  Question: I am running a program that runs in multiple threads will be derived. I want to know how many there will be threaded programs at runtime. What is the number of threads in the inspection process of Linux the easiest way?

If you want to see the number of threads per process in Linux, there are several ways to do this.


Method one: / proc

proc pseudo file system, which resides in the / proc directory, which is the easiest way to view any active process threads. / Proc directory in readable text file output, existing processes and systems to provide hardware-related information such as CPU, memory, disk, and so on.

$ Cat / proc / < pid > / status
Process < pid > For more information, including the status of the process (for example, sleeping, running), the number of the parent process PID, UID, GID, use file descriptors, and the number of context switches above command will be displayed. Output also includes the total number of threads created by the process shown below.

Threads: < N >
For example, check the number of threads process PID 20571:

$ Cat / proc / 20571 / status

It shows that the process has 28 threads.

Or, you can simply the number in / proc // task statistics subdirectories, as shown below.

$ Ls / proc / < pid > / task | wc
This is because, for each thread in a process created in the / proc / < pid > / task will be created in the appropriate directory, named for its thread ID. Thus the / proc / / task directory indicates the number of the total number in the process threads.


Method Two: ps

If you are a loyal user powerful ps command, this command can also tell you that a process (with "H" option) number of threads. The following command will output the number of threads of a process. "H" in front of the desired option.

$ Ps hH p < pid > | wc-l
- How to contribute code to the GNU Project (Linux)
- C ++ casts New Standard Comments (Programming)
- Apache2.4.7 make an error [exports.lo] Error 1 Solution (Server)
- Oracle Incident Packaging Service (Database)
- Oracle delete table space prompted ORA-00604 and ORA-38301 (Database)
- Parse Server supports iOS and Android push messaging (Programming)
- How to configure Apache Solr on Ubuntu 14/15 (Server)
- Detailed use Zabbix monitoring Nginx (Server)
- Ceph single / multi-node installation summary Powered by CentOS 6.x (Server)
- Build and verify MongoDB3.0.7 version (shard + replica) Cluster (Database)
- Linux network monitoring tools ntopng installation (Linux)
- To compiler and install MariaDB-10.0.20 under CentOS 6.6 (Database)
- Linux vi command list (Linux)
- JSON Introduction and Usage Summary (Programming)
- Oracle SQL statement tracking (Database)
- Bash difference in single quotes and double quotes (Programming)
- CentOS of NFS (Server)
- NAT and firewall under Linux (Linux)
- Monitoring Linux System 7 command-line tool (Linux)
- Python2.7.7 source code analysis (Programming)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.