How to set one task’s CPU affinity quickly?

How to set one task’s CPU affinity quickly?

1, Get this task’s ID

# taskset -pc PID

2, Set this task’s CPU affinity

# taskset -c affinity ./task
Answered by harryxiyou.

There is also another format

# taskset -pc affinity pid

For example: set process with PID 3783 to CPU 15

# taskset -pc 15 3783

Weiwei Jia

Weiwei Jia is a Ph.D. student in the Department of Computer Science at New Jersey Institute of Technology since 2016. His research interests are include storage systems, operating systems and computer systems.

Leave a Reply

Your email address will not be published. Required fields are marked *