[英]What is the difference between cgroups freeze and linux command "Kill - STOP pid" in golang?
I use thiscgroups package.我使用这个cgroups package。
There are two interfaces I am interested in for type Cgroup
.我对
type Cgroup
有两个接口感兴趣。 The one is Freeze() error
and the other is Thaw() error
.The description of them is as follows:一个是
Freeze() error
,一个是Thaw() error
。它们的描述如下:
...
// Freeze freezes or pauses all processes inside the cgroup
Freeze() error
// Thaw thaw or resumes all processes inside the cgroup
Thaw() error
...
And there are two linux command that can pause and resume a process, which is kill -STOP pid
and kill -CONT pid
.并且有两个 linux 命令可以暂停和恢复进程,即
kill -STOP pid
和kill -CONT pid
。
I wonder that if there is only one process in a cgroup, does it has any difference between these two ways to pause and resume the process?我想知道如果一个cgroup中只有一个进程,这两种暂停和恢复进程的方式有什么区别吗? Thanks.
谢谢。
Both states were introduced in oct.这两个州都是在 10 月引入的。 2016 in
containerd/cgroups
commit b3f3344 and refer to cgroup v1 self-state 2016 年在
containerd/cgroups
提交 b3f3344并参考cgroup v1 自我状态
The cgroup freezer is hierarchical.
cgroup freezer 是分层的。
Freezing a cgroup freezes all tasks beloning to the cgroup and all its descendant cgroups.
冻结一个 cgroup 会冻结属于该 cgroup 及其所有后代 cgroup 的所有任务。
Each cgroup has its own state (self-state) and the state inherited from the parent (parent-state).每个cgroup都有自己的state(self-state)和从parent继承的state(parent-state)。
Iff both states are THAWED, the cgroup is THAWED.如果两个状态都已解冻,则 cgroup 已解冻。
CGroup Freezer states: CGroup 冷冻机状态:
freezer.state
is only available in non-root cgroups and has three possible values:freezer.state
仅在非根 cgroups 中可用,具有三个可能的值:
FROZEN
— tasks in the cgroup are suspended.FROZEN
— cgroup 中的任务被暂停。FREEZING
— the system is in the process of suspending tasks in the cgroup.FREEZING
— 系统正在挂起 cgroup 中的任务。THAWED
— tasks in the cgroup have resumed.THAWED
— cgroup 中的任务已恢复。
The freezer subsystem is used to suspend and resume processes in the cgroup.
freezer 子系统用于暂停和恢复 cgroup 中的进程。
Freezer has a control file:
freezer.state
, writeFROZEN
to this file, you can suspend the process in the cgroup, and writeTHAWED
to this file, you can resume the suspended process.Freezer有一个控制文件:
freezer.state
,写FROZEN
到这个文件,可以挂起cgroup中的进程,写THAWED
到这个文件,可以恢复挂起的进程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.