The question is all in the title: How can I set the processor affinity of a process on Linux?
|
I have used taskset for this. If you have taskset installed, something like:
would set the process with id 45678 to have an affinity to cpus 1 and 3. |
|||
|
|
|
Inside the process, the call would be On a related note, if you're worrying about CPU affinity of your program, it may be worthwhile to pay attention to how it's doing memory allocation as well. Larger systems with memory attached to more than one controller (i.e. multiple CPU sockets, each with their own) will have variable latency and bandwidth between different CPU-memory pairs. You'll want to look into NUMA affinity as well, using the |
||||
|
|
|
You need to install SF link |
||||
|
|