Show Table of Contents
3.2. cpu
cpu 子系统调度对 cgroup 的 CPU 访问。可根据以下参数调度对 CPU 资源的访问,每个参数都独立存在于 cgroup 虚拟文件系统的伪文件中:
- cpu.shares
- 包含用来指定在 cgroup 中的任务可用的相对共享 CPU 时间的整数值。例如:在两个 cgroup 中都将
cpu.shares设定为1的任务将有相同的 CPU 时间,但在 cgroup 中将cpu.shares设定为2的任务可使用的 CPU 时间是在 cgroup 中将cpu.shares设定为1的任务可使用的 CPU 时间的两倍。 - cpu.rt_runtime_us
- 以微秒(µs,这里以“us”代表)为单位指定在某个时间段中 cgroup 中的任务对 CPU 资源的最长连续访问时间。建立这个限制是为了防止一个 cgroup 中的任务独占 CPU 时间。如果 cgroup 中的任务应该可以每 5 秒中可有 4 秒时间访问 CPU 资源,请将
cpu.rt_runtime_us设定为4000000,并将cpu.rt_period_us设定为5000000。 - cpu.rt_period_us
- 以微秒(µs,这里以“us”代表)为单位指定在某个时间段中 cgroup 对 CPU 资源访问重新分配的频率。如果某个 cgroup 中的任务应该每 5 秒钟有 4 秒时间可访问 CPU 资源,则请将
cpu.rt_runtime_us设定为4000000,并将cpu.rt_period_us设定为5000000。

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.