How can I find out which CPU kernel is running the process?

Source: Internet
Author: User

Tag: CPU core is running

The affinity of Cpu/memory is one of the most important factors for maximizing performance when you run HPC (High performance computing) programs that require higher performance on multicore NUMA processors or programs that consume network resources very well. Scheduling the most relevant processes on the same NUMA node can reduce slow remote memory access. Like the Intel Sandy Bridge processor, the processor has an integrated PCIe controller that allows you to schedule network I/O loads (such as network cards) on the same NUMA node to break the PCI-to-CPU affinity limit.


As part of performance optimization and troubleshooting, you may want to know which CPU cores (or NUMA nodes) a particular process is scheduled to run on.


Here are a few ways to find out which CPU kernel is scheduled to run a given Linux process or thread.

Method One


If a process uses the Taskset command to explicitly be pinned (pinned) to a specific kernel of the CPU, you can use the Taskset command to find the fixed CPU core:


$ taskset-c-P <pid>


For example, if you are interested in the PID 5357 process:


$ taskset-c-P 5357

PID 5357 ' s current affinity list:5


The output shows that the process is fixed on CPU core 5.


However, if you do not explicitly fix the process to any CPU kernel, you will get a list of affinity similar to the following.


PID 5357 ' s current affinity list:0-11


The output indicates that the process may be scheduled in any one of the CPU cores from 0 to 11. In this case, Taskset does not recognize which CPU kernel the process is currently assigned to, you should use the method described below.


How can I find out which CPU kernel is running the 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.