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     - Linux operating system log system (Linux)

- Linux prohibit non-WHEEL user su command Detail (Linux)

- Android developers learning Adapter (data adapter) (Programming)

- Cacti installation deployment under CentOS 6.6 (Server)

- Build a super simple "hardware" firewall router (Linux)

- Bitmap memory footprint of computing Android memory optimization (Linux)

- What factors affect the performance of Java calls (Programming)

- Kubernetes Cluster Setup problems encountered and solutions (Server)

- Common data structures and functions of Linux process scheduling (Programming)

- jdbc Oracle database connection string writing pluggable (Database)

- Installing Linux and Windows 10 dual system (Linux)

- C ++ based foundation: the difference between C and C ++ (Programming)

- Linux Task Scheduler (at, crontab) (Linux)

- Linux user groups, file permissions Detailed (Linux)

- How to enable curl command HTTP2 support (Linux)

- Use PDFBox processing PDF documents (Linux)

- ASP.NET 5 (vNext) Linux deployment (Server)

- Java eight new features 8 (Programming)

- JavaScript is implemented without new keywords constructor (Programming)

- RAID disk array Description (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
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).
- 2016, the new Node project Precautions (Programming)
- Shell Script: create a function and specify a directory for download (Programming)
- PostgreSQL with the C Completing the storage process instances (Database)
- RHEL 6.5 KVM analytical use (Server)
- Linux upgrade Glibc (Linux)
- Java regular expression syntax (Programming)
- Go build the locale under Windows (Linux)
- There is sort of a directed acyclic graph topology (Programming)
- Optimized to minimize the installation of CentOS 5.8 (Linux)
- Zabbix API and PHP configuration (Server)
- Slow update statement Performance Analysis (Database)
- Using RAID in Linux: Create a RAID 5 (Linux)
- How to Install Linux kernel 4.0 on Ubuntu / CentOS (Linux)
- [Android] Eclipse does not update the Android SDK Manager solution [using GoAgent] (Programming)
- Java programmers talk about those advanced knowledge and direction (Programming)
- To protect the temporary files for Linux security (Linux)
- Spring Data study notes -Helloworld (Programming)
- Difference Docker mirror and containers (Server)
- How to Use Nmap security scanner tool on Linux (Linux)
- GAMIT 10.50 installed in Ubuntu 12.04 system (Linux)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.