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 使用率,可见迅速递减。






你可能感兴趣的:(cgroup--freezer测试)