Show Table of Contents
2.9.2. root コントロールグループ内のプロセスの振る舞い
blkio および cpu の特定の設定オプションは、root cgroup 内で実行中のプロセス (タスク) に影響を及ぼします。これは、サブグループ内で実行中のプロセスの場合とは方法が異なります。以下の例を検討してください。
- root グループ下に 2 つのサブグループを作成します:
/rootgroup/red/および/rootgroup/blue/ - 各サブグループおよび root グループで
cpu.shares設定オプションを定義し、1に指定します。
上記で設定したシナリオでは、各グループにプロセスを 1 つずつ配置すると (
/rootgroup/tasks、/rootgroup/red/tasks、および /rootgroup/blue/tasks に 1 タスク)、CPU を 33.33% 消費します。
/rootgroup/process: 33.33%/rootgroup/blue/process: 33.33%/rootgroup/red/process: 33.33%
サブグループ
blue および red にその他のプロセスを配置すると、その特定のサブグループに割り当てられている 33.33% の CPU は、そのサブグループ内の複数のプロセス間で分割されます。
しかし、複数のプロセスが root グループに配置されると、 CPU プロセスはグループ別ではなくプロセス別に分割されます。たとえば、
/rootgroup/ に 3 つのプロセス、/rootgroup/red/ に 1 つのプロセス、/rootgroup/blue/ に 1 つのプロセスがあり、全グループで cpu.shares オプションが 1 に設定されている場合、CPU リソースは以下のように分配されます。
/rootgroup/processes: 20% + 20% + 20%/rootgroup/blue/process: 20%/rootgroup/red/process: 20%
したがって、使用可能なリソースをウェイトまたは配分に基づいて分配する
blkio および cpu 設定オプション (例: cpu.shares、blkio.weight など) を使用する場合には、全プロセスを root グループから特定のサブグループに移動することを推奨します。root グループから特定のサブグループに全タスクを移動するには、以下のコマンドを使用することができます。
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.