Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Getting Started with Linux system to learn: How do I know which processes are running on the CPU core     - VMware virtual machines to install virt-manager unable to connect to libvirt's approach (Linux)

- Learning UNIX good habits (Linux)

- Eclipse configuration GTK (Linux)

- Analysis examples: Intrusion Response Linux platform Case (Linux)

- Preliminary understanding of SELinux security management (Linux)

- Using Python and OpenCV detecting image barcode (Programming)

- The oh-my-zsh into true my zsh (Linux)

- Android Custom View password box example (Programming)

- Oracle 11g RAC root.sh execution error second node failure example (Database)

- Linux port mapping system (routing and forwarding) (Server)

- Oracle Listener can not start (TNS-12555, TNS-12560, TNS-00525) (Database)

- Linux System Getting Started Learning: Repair (Linux)

- How to use the Linux terminal Git commands (Linux)

- Linux shell in back quotes (`) Application (Linux)

- How to manage Vim plugin (Linux)

- Linux iptables: basic principles and rules (Linux)

- Usage sed some of the parameters (Linux)

- I use the desktop environment in GNU / Linux combination tool (Linux)

- Ubuntu font settings: Using Windows Font (Linux)

- Android studio multi-channel ultra-compact version of the package (Programming)

 
         
  Getting Started with Linux system to learn: How do I know which processes are running on the CPU core
     
  Add Date : 2018-11-21      
         
       
         
  Question: I have a Linux processes running on multi-core processor systems. How can I find out which CPU core running the process?

When you run on a multicore NUMA processor requires high performance HPC (High Performance Computing) program or consuming network resources program, the affinity CPU / memory is one of the important factors that limit its maximum performance. Scheduling the most relevant processes on the same NUMA node can be reduced slowly remote memory access. Like Intel Sandy Bridge processor, which has an integrated PCIe controller, you can schedule the network I / O load (such as NICs) on the same NUMA node affinity to break through the PCI to CPU restrictions.

As part of the performance optimization and troubleshooting, you might want to know the specific process which is scheduled to CPU core (or NUMA node) to run on.

There are several ways to find out which CPU cores are scheduled to run a given Linux processes or threads.

method one

If a process uses taskset clear command is fixed (pinned) to a specific core CPU, you can use the command to find out taskset fixed CPU core:

$ Taskset -c -p < pid >
For example, if you are interested in the process PID 5357:

$ Taskset -c -p 5357
pid 5357's current affinity list: 5
Output show this process is fixed on the CPU core 5.

However, if you do not explicitly fixed process to any CPU core, you will get something like the following list of affinity.

pid 5357's current affinity list: 0-11
It shows that the process may be arranged in any of 0-11 from a CPU core. In this case, taskset not recognize that the process is currently assigned to which CPU cores, you should use the method described below.

Method Two

ps command can tell you that each process / thread is currently assigned to (the "PSR" column) CPU ID.

$ Ps-o pid, psr, comm -p
PID PSR COMMAND
535710 prog
Output indicates the PID of 5357 (known as "prog") currently running on the CPU core 10. If the process is not fixed, PSR column based on the kernel may schedule the process to a different kernel and change the display.

Method Three

top command can display a CPU is assigned to which process. First, use the "P" option in the top command. Then press the "f" key, the display will appear in "Last used CPU" column. CPU currently used by the kernel will appear in the column under the "P" (or "PSR").

$ Top-p 5357

Benefits compared to the ps command, use the top command is that you can continuously monitor changes over time, CPU is the distribution.

Method Four

Another to check a process / thread is currently using a CPU core which is to use htop command.

Launching from the Command htop. Press the key to enter the "Columns", under the "Available Columns" adds PROCESSOR.

Each process is currently used by CPU ID will appear in the "CPU" column.

Please note that all commands previously used taskset, ps and top IDs assigned CPU core is 0,1,2, ..., N-1. However, htop assigned IDs starting from 1 CPU core (up to N).
     
         
       
         
  More:      
 
- C language function pointer and a callback function (Programming)
- Dialogue UNIX:! $ # @ *% (Linux)
- Linux terminal program running in the background (Linux)
- Linux Regular expressions grep and egrep (Linux)
- Ubuntu 15.04 Linux install anti-virus software Antiviral 0.2 (Linux)
- Diagnose and resolve the SSH connection slow (Linux)
- Linux shell string interception and stitching (Linux)
- Compile and install Memcached can not find GCC (Programming)
- Five Linux user space debugging tool (Linux)
- OpenDaylight Helium version installed (Linux)
- Configuration OpenOCD + FT2232 under Ubuntu (Linux)
- MySQL development common query summary (Database)
- Upgrading to Debian 7.6 glibc 2.15 (Linux)
- NGINX Plus now fully supports HTTP / 2 (Server)
- Java class HashSet (Programming)
- How nodeclub constructed Docker image (Server)
- RHEL6 install Python and other packages from source (Linux)
- Difference in MySQL VARCHAR and CHAR data format (Database)
- Python 2.7.9 Installation on Linux CentOS 6.6 (Linux)
- Graphical interface for the CentOS 6.4 installed and connected by remote VNC (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.