Linux Shell View how the process runs or binds the CPU and bind execution process to a specific CPU __linux

Source: Internet
Author: User
The following command lets you see which CPU the process is running on.
vostro-270s:$ Ps-elo RUSER,PID,PPID,PSR
Root 3 2 0
Root 5 2 0
Root 8 2 0
Root 10 2 0
Root 11 2 0

Root 12 2 0

To explain the above command, the PS command displays the status of process information for the current system, its "-e" parameter is used to display all processes, and "-l" is used to display the thread (light-weight process). "-o" indicates custom format output. Ruser represents the user who is running the process, and the PID represents the id,ppid of the process representing the parent process ID,PSR representing the processor number assigned to the process.

To bind a process to a method that executes the CPU:

taskset-p [mask] pid

Mask: A mask number that represents processor affinity, which, when converted to binary, represents the first logical CPU to the last logical CPU from the lowest to highest, and the process scheduler may dispatch the process to run on a logical CPU that is represented by all bits marked "1". Taskset-p 0x05 3963, which indicates that the 3936 process is scheduled to execute on the No. 0 and 3rd CPUs.

Taskset-p 0x04 3963

Related Article

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: 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.