Bind a process to a CPU using the Taskset command

Source: Internet
Author: User

taskset  (util-linux-ng 2.17.2) usage: taskset [options] [mask | cpu-list]  [pid | cmd [args ...] set or get the affinity of a process  -p, --pid                   operate  on existing given pid  -c, --cpu-list              display and specify cpus in list format   -h, --help                  display this help  -V, --version               output version informationThe  default behavior is to run a new command:  taskset 03 sshd -b 1024you can retrieve the mask of an existing  Task:  taskset -p 700or set it:  taskset -p 03 700list  format uses a comma-separated list instead of a mask:   taskset -pc 0,3,7-11 700ranges in list format can take a  stride argument:  e.g. 0-31:2 is equivalent to mask  0x55555555

Cases:

Bind a process with PID number 2181 to cpu0:

[Email protected] ~]# TASKSET-CP 0 2181pid 2181 ' s current affinity list:0pid 2181 ' s new affinity list:0

Bind a process with PID number 2181 to several CPUs:

[[email protected] ~]# TASKSET-CP 0,1 2181--bind to Cpu0 and CPU1


Bind a process to a CPU using the Taskset command

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.