简体   繁体   中英

How to restrict a CPU core to only 2 applications using Linux scheduler?

I would like to study the interaction between two applications on a CPU core, one is persistent application (NVM resident) and another is regular (DRAM resident). For this I want to only schedule these 2 applications on a core and nothing else. I am looking at Linux scheduler to accomplish this. Can someone please help me with a direction to achieve this? Can I achieve this using sched or do I need to modify the scheduler code of kernel so that scheduler does not schedule applications to the core of my interest.

You can use the isolcpus command-line parameter of the kernel:

This option can be used to specify one or more CPUs to isolate from the general SMP balancing and scheduling algorithms. You can move a process onto or off an "isolated" CPU via the CPU affinity syscalls or cpuset.

isolcpus is a solution but the linux kernel documentation declares it as deprecated:

isolcpus= [KNL,SMP,ISOL] Isolate a given set of CPUs from disturbance.
[Deprecated - use cpusets instead]

The cpuset sub-system of the cgroups is preferable. A tool like partrt is based on this principle to divide the CPU cores in two subsets: nrt where all the processes run and rt into which you can move your applications. Hence, the applications are isolated on some CPU cores.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM