Just how can I set the cpu fondness of a process on Linux?

The inquiry is done in the title: Just how can I set the cpu fondness of a process on Linux?

0
2019-05-04 19:16:59
Source Share
Answers: 3

I have actually made use of taskset for this. If you have actually taskset mounted, something like :

taskset -c 1,3 -p 45678

would certainly set the process with id 45678 to have a fondness to cpus 1 and also 3.

0
2019-05-08 06:57:18
Source

Inside the process, the call would certainly be sched_setaffinity(), or for pthreads things, pthread_setaffinity_np()

On a relevant note, if you're bothering with CPU fondness of your program, it might be rewarding to take notice of just how it's doing memory appropriation too. Bigger systems with memory affixed to greater than one controller (i.e. numerous CPU outlets, each with their very own) will certainly have variable latency and also transmission capacity in between various CPU - memory sets. You'll intend to check into NUMA fondness too, making use of the numactl command or the system calls that it collaborates with. One program I worked with obtained a 10% efficiency renovation from this.

0
2019-05-08 06:32:08
Source

You require to install schedutils (Linux scheduler energies). I have utilize it on my Ubuntu Desktop.

SF link

0
2019-05-08 04:41:51
Source