Show Table of Contents
2.9.2. Process Behavior in the Root Control Group
Certain
blkio and cpu configuration options affect processes (tasks) running in the root cgroup in a different way than those in a subgroup. Consider the following example:
- Create two subgroups under one root group:
/rootgroup/red/and/rootgroup/blue/ - In each subgroup and in the root group, define the
cpu.sharesconfiguration option and set it to1.
In the scenario configured above, one process placed in each group (that is, one task in
/rootgroup/tasks, /rootgroup/red/tasks and /rootgroup/blue/tasks) consumes 33.33% of the CPU:
/rootgroup/process: 33.33%/rootgroup/blue/process: 33.33%/rootgroup/red/process: 33.33%
Any other processes placed in subgroups
blue and red result in the 33.33% percent of the CPU assigned to that specific subgroup to be split among the multiple processes in that subgroup.
However, multiple processes placed in the root group cause the CPU resource to be split per process, rather than per group. For example, if
/rootgroup/ contains three processes, /rootgroup/red/ contains one process and /rootgroup/blue/ contains one process, and the cpu.shares option is set to 1 in all groups, the CPU resource is divided as follows:
/rootgroup/processes: 20% + 20% + 20%/rootgroup/blue/process: 20%/rootgroup/red/process: 20%
Therefore, it is recommended to move all processes from the root group to a specific subgroup when using the
blkio and cpu configuration options which divide an available resource based on a weight or a share (for example, cpu.shares or blkio.weight). To move all tasks from the root group into a specific subgroup, you can use the following commands:
rootgroup]#cat tasks >> red/tasksrootgroup]#echo > tasks

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.