其他分享
首页 > 其他分享> > cgroup简介

cgroup简介

作者:互联网

介绍
cgroup是control group的简称,cgroup是Linux下的一种将进程按组进行管理的机制。

组成

查看系统支持的subsystem

# cat /proc/cgroups
subsys_name    hierarchy       num_cgroups     enabled
cpuset      11         1                1
cpu         5         3          1
cpuacct       5         3          1
blkio         9         25            1
memory      7         473            1
devices      3         23             1
freezer      12         1              1
net_cls      6         1                1
perf_event    2         1                1
net_prio      6         1                1
hugetlb       4         1                1
pids        8         63              1
rdma       10          1               1                

创建和删除cgroup
在对应的目录下创建或删除对应的子目录即可。

# ll /sys/fs/cgroup/
dr-xr-xr-x 4 root root 0 Jan 13 2021 blkio
lrwxrwxrwx 1 root root 11 Jan 13 2021 cpu -> cpu,cpuacct
lrwxrwxrwx 1 root root 11 Jan 13 2021 cpuacct -> cpu,cpuacct
dr-xr-xr-x 4 root root 0 Jan 13 2021 cpu,cpuacct
dr-xr-xr-x 2 root root 0 Jan 13 2021 cpuset
dr-xr-xr-x 4 root root 0 Jan 13 2021 devices
dr-xr-xr-x 2 root root 0 Jan 13 2021 freezer
dr-xr-xr-x 2 root root 0 Jan 13 2021 hugetlb
dr-xr-xr-x 5 root root 0 Jan 13 2021 memory
lrwxrwxrwx 1 root root 16 Jan 13 2021 net_cls -> net_cls,net_prio
dr-xr-xr-x 2 root root 0 Jan 13 2021 net_cls,net_prio
lrwxrwxrwx 1 root root 16 Jan 13 2021 net_prio -> net_cls,net_prio
dr-xr-xr-x 2 root root 0 Jan 13 2021 perf_event
dr-xr-xr-x 4 root root 0 Jan 13 2021 pids
dr-xr-xr-x 2 root root 0 Jan 13 2021 rdma
dr-xr-xr-x 5 root root 0 Jan 13 2021 systemd

 

标签:13,简介,Jan,2021,cgroup,xr,root
来源: https://www.cnblogs.com/KrillLiszt/p/16155392.html