cgroup--freezer测试

   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.

               T HAWED — tasks in the cgroup have resumed.



T o suspend a specific process:
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 使用率,可见迅速递减。






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值