Confuzzled
Very Active Member
- Joined
- Oct 1, 2018
- Messages
- 299
There are several mechanisms, of different utility and complexity. nice, cpulimit and cgroups. cgroups is a general resource controller which is complicated to set up, but has most flexibility.Is there a mechanism in Linux to limit an application to only X cycles or y% of 1 CPU core or such? I don't want to underclock the whole system to keep an overly greedy application in check.
Restricting process CPU usage using nice, cpulimit, and cgroups | Scout APM Blog
There are at least three ways in which you can control how much CPU time a process gets: use the nice command, cpulimit, or Linux's cgroups.
scoutapm.com
I recommend reading up on cgroups, because as well as enforcing relative cpu usage restrictions (e.g. one process gets twice as much as another if they are competing for the same thing), you can also set cpu usage ceilings with the cpu.cfs_period_us and cpu.cfs_quota_us ( https://access.redhat.com/documenta...ml/resource_management_guide/sec-cpu#sect-cfs ).
I don't know if the letux kernel offers the cgroups capability, and if so, whether it is V1 or V2.