Dedicate a CPU to a Process – How to

cpuprocess

I've tried to search for a solution, but all I found was how to pin processes to CPU using taskset or sched_setaffinity. But it looks like this won't give the process exclusive access to the CPU, i.e., scheduler may assign some other process on this CPU. Is there any way or command by which we can ensure that the CPU is dedicated to the process? With taskset we can make sure a particular process runs only on particular CPU, but I want it to be other way too, where CPU is binded to that process. I've found questions like How to allocate a process specific amount of CPU power? and How to limit a process to one CPU core in Linux? but they got marked as duplicate of How can I set the processor affinity of a process on Linux? which is not what I want.

Best Answer

You Need to exclude one CPU from the Overall scheduling, afterwards you can assign the process to it via

taskset

as you already found out. To exclude a CPU, add the boot Parameter

isolcpus=N

The Number (N) is 0-based.

Related Question