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     - The strings in Python reside (Programming)

- Java class loading order (Programming)

- Volatile keyword in C language understanding (Programming)

- Win8 mount disk partitions under Ubuntu (Linux)

- Shell Script: create a function and specify a directory for download (Programming)

- Oracle row and column switch to turn columns (Database)

- Process monitoring tools Supervisor start MongoDB (Database)

- Install Rubinius testing Ubuntu 14.04 native threads (Linux)

- a virtual machine created migrated to host RHEL6.4 on Ubuntu 14.04 (Linux)

- Linux iptables port mapping settings (Server)

- Spring3 + SpringMVC + Hibernate4 full annotation environment configuration (Server)

- Linux systems for entry-learning - Install Go language in Linux (Linux)

- Use ARChon runtime environment to run Android apps on Ubuntu (Linux)

- AppCode developed Mac OS X application or shared library experience summary (Programming)

- To install the Contiki development toolchain on Ubuntu (Linux)

- Why HBase need to build SQL engine layer (Database)

- Ubuntu and Derivatives users install the latest KKEdit 0.0.31 (Linux)

- Java Access Control (Programming)

- C ++ virtual functions Classic Insights (Programming)

- DIY security of Linux platform (Linux)

 
         
  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:      
 
- Build their own recursive DNS server (Server)
- How to add two-factor authentication for Linux systems SSH (Linux)
- Three easy open source firewall on the Linux platform (Linux)
- How to restart after a crash Cinnamon (Linux)
- Android will save the picture to see the album and timely (Programming)
- Shell programming entry (Programming)
- Use Nginx as a load balancer (Server)
- How to use Xmanager Remote Desktop and VNC Log (Linux)
- Linux environment has been running Tomcat how to deploy the new Tomcat (Server)
- Linux security-related basics (Linux)
- RPM package fabrication method (Linux)
- To resolve Ubuntu 14.04 Unity Desktop Environment Login freeze problem (Linux)
- Linux common commands: nslookup, ls md5sum, uname, history, etc. (Linux)
- Detailed installation OpenCV2.3.1 under CentOS 6.5 (Linux)
- Ubuntu 14.04 build Gitlab (Linux)
- To explore the caching mechanism for Android ListView (Programming)
- Linux, how to filter, split, and merge pcap file (Linux)
- imp / exp Oracle Database import and export commands (Database)
- Restrict console access to Linux servers to improve security (Linux)
- Talking about modern programming language syntax and standard library tightly bound phenomenon (Programming)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.