Run a particular process with cpu cores 4 and 5
taskset -cp 4,5 <process_id>
Example:
[root@masterDNS ~]# taskset 03 /usr/bin/watch -n1 w
Now check if it's really working
[root@masterDNS ~]# ps -ef | grep watch
root 14590 14365 0 20:00 pts/0 00:00:00 /usr/bin/watch -n1 w
root 14644 14609 0 20:00 pts/1 00:00:00 grep watch
[root@masterDNS ~]# taskset -p 14590
pid 14590's current affinity mask: 3
If We want to dedicate a whole CPU core to a particular program and no other then your process should use this core.
Then use "isolcpus" kernel parameter in grub option.
GRUB_CMDLINE_LINUX_DEFAULT="cpuidle.off=1 idle=poll isolcpus=5 nohz_full=5 maxcpus=6"
update-grub
Note: below are meaning
cpuidle.off=1 (Do not make cpu idle)
isolcpus=5 (Isolate cpu core 5)
maxcpus=6 (Use only 6 core (out of 8 cores of system) for )
idle=poll (Poll forces a polling idle loop)
taskset -cp 4,5 <process_id>
Example:
[root@masterDNS ~]# taskset 03 /usr/bin/watch -n1 w
Now check if it's really working
[root@masterDNS ~]# ps -ef | grep watch
root 14590 14365 0 20:00 pts/0 00:00:00 /usr/bin/watch -n1 w
root 14644 14609 0 20:00 pts/1 00:00:00 grep watch
[root@masterDNS ~]# taskset -p 14590
pid 14590's current affinity mask: 3
If We want to dedicate a whole CPU core to a particular program and no other then your process should use this core.
Then use "isolcpus" kernel parameter in grub option.
GRUB_CMDLINE_LINUX_DEFAULT="cpuidle.off=1 idle=poll isolcpus=5 nohz_full=5 maxcpus=6"
update-grub
Note: below are meaning
cpuidle.off=1 (Do not make cpu idle)
isolcpus=5 (Isolate cpu core 5)
maxcpus=6 (Use only 6 core (out of 8 cores of system) for )
idle=poll (Poll forces a polling idle loop)
Very nice post. I just stumbled upon your blog and wanted to say that I've really enjoyed surfing around your blog posts. After all, I will be subscribing to your feed and I hope you write again very soon! Resources: How To Lock Files From Scratch
ReplyDelete