Show Table of Contents
3.7. 启动控制群组的进程
您可以通过运行
cgexec 指令在手动创建的 cgroup 中启动进程。cgexec 的语法为:
cgexec-gcontrollers:path_to_cgroup command arguments
其中:
- controllers 是管控器列表,以逗号分隔;或者使用
*来启动与所用可用子系统相关的层级中的进程。请注意,与〈第 3.5 节 “设定 cgroup 参数”〉所描述的cgset指令一样,如果几个 cgroup 的名称相同,-g选项会在每一个 cgroup 中都创建进程; - path_to_cgroup 是与层级相对的 cgroup 路径;
- command 是要在该 cgroup 中执行的指令;
- arguments 是该指令的所有参数。
您也可以在 command 前添加
--sticky 选项,以便让所有子进程位于同一个 cgroup 中。如果您没有设定此选项且 cgred 后台驻留程序正在运行,子进程将会根据 /etc/cgrules.conf 中的设定被分配到 cgroup 中。 而进程本身会保留在启动它的 cgroup 中。

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.