What Does Taskset Do in Linux?
Contents

The taskset command is used to set or retrieve the CPU affinity of a running process given its pid, or to launch a new command with a given CPU affinity. CPU affinity is a scheduler property that “bonds” a process to a given set of CPUs on the system.

How to use taskset command?

With the help of the “taskset” command tool, the user can fetch or set the CPU affinity of a particular process with its given process id (PID).
…
Taskset Commands Options:

Option Description
-a, –all Used to set the CPU affinity of all tasks for the given PID

What is CPU pinning in Linux?

Processor affinity, or CPU pinning or “cache affinity”, enables the binding and unbinding of a process or a thread to a central processing unit (CPU) or a range of CPUs, so that the process or thread will execute only on the designated CPU or CPUs rather than any CPU.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest