The freezer subsystem suspends or resumes tasks in a cgroup.
freezer.state
freezer.state has three possible values:
FROZEN — tasks in the cgroup are suspended.
FREEZING — the system is in the process of suspending tasks in the cgroup.
1. Move that process to a cgroup in a hierarchy which has the freezer subsystem attached to it.
将这个任务 attack 进 test :
观察cpu 使用率,可见迅速递减。
freezer.state
freezer.state has three possible values:
FROZEN — tasks in the cgroup are suspended.
FREEZING — the system is in the process of suspending tasks in the cgroup.
T HAWED — tasks in the cgroup have resumed.
1. Move that process to a cgroup in a hierarchy which has the freezer subsystem attached to it.
2. Freeze that particular cgroup to suspend the process contained in it.
It is not possible to move a process into a suspended (frozen) cgroup.
Note that while the FROZEN and T HAWED values can be written to freezer.state,
FREEZING cannot be written, only read.
创建一个任务
sina@ubuntu:~$ ./a.out &
[1] 9343
将这个任务 attack 进 test :
root@ubuntu:/sys/fs/cgroup/freezer/test# echo 9343 > tasks
把任务的状态设置为 FROZEN
root@ubuntu:/sys/fs/cgroup/freezer/test# echo FROZEN > freezer.state
观察cpu 使用率,可见迅速递减。
本文介绍如何利用cgroup的freezer子系统来冻结特定进程。通过将进程移动到包含freezer子系统的cgroup中,并设置状态为FROZEN,可以实现进程的暂停。文章还演示了实际操作步骤。
1518

被折叠的 条评论
为什么被折叠?



