The cpu
subsystem schedules CPU access to control groups. Access to CPU resources can be scheduled according to the following parameters, each one in a separate pseudofile within the control group virtual file system:
- cpu.shares
contains an integer value that specifies a relative share of CPU time available to the tasks in a control group. For example, tasks in two control groups that have cpu.shares
set to 1
will receive equal CPU time, but tasks in a control group that has cpu.shares
set to 2
receive twice the CPU time of tasks in a control group where cpu.shares
is set to 1
.
- cpu.rt_runtime_us
specifies a period of time in microseconds (µs, represented here as "us") for the longest continuous period in which the tasks in a control group have access to CPU resources. Establishing this limit prevents tasks in one control group from monopolizing CPU time. If the tasks in a control group should be able to access CPU resources for 4 seconds out of every 5 seconds, set cpu.rt_runtime_us
to 4000000
and cpu.rt_period_us
to 5000000
.
- cpu.rt_period_us
specifies a period of time in microseconds (µs, represented here as "us") for how regularly a control group's access to CPU resource should be reallocated. If the tasks in a control group should be able to access CPU resources for 4 seconds out of every 5 seconds, set cpu.rt_runtime_us
to 4000000
and cpu.rt_period_us
to 5000000
.