当前位置:网站首页>cgroup简介
cgroup简介
2022-07-03 11:01:00 【InfoQ】
- 什么是cgroups ?
- 为什么需要cgroups ?
- cgroups是怎么实现的?
- 如何使用cgroups ?
1 什么是cgroups ?
2 为什么需要cgroups?
echo pid > /sys/fs/cgroup/network/<new_class>/tasks
3 cgroup是如何实现的?
- 每个任务在系统中指向一个css_set结构体指针.
- 一个css_set 含有一系列指向cgroup_subsys_state结构体的指针, 每个cgroup_subsys_state对应一个cgroup subsystem.
- cgroup hierarchy 文件可以被挂载浏览、执行用户态操作.
- 查看cgroup下所有的任务PID.
- tasks: 一系列的pids. 将进程ID写入这个文件会将其移动到这个cgroup.
- cgroup.procs: 一系列的进程组IDs.将进程组ID写入这个文件会将其移动到这个cgroup.
- notify_on_release flag: 是否运行release agent?
- release_agent: 用于发布通知的路径(此文件仅存在于顶级 cgroup)

4 如何使用cgroups ?
## 限制cpu、mem使用
cd /sys/fs/cgroup/cpu_mem_cg
mkdir cg2
cd cg2
/bin/echo 2-3 > cpuset.cpus
/bin/echo 1 > cpuset.mems
/bin/echo 51565 > tasks
## 限制net使用
cd /sys/fs/cgroup/net/cg3
/bin/echo 51565 > tasks

边栏推荐
- Yintai department store ignites the city's "night economy"
- [OBS] encapsulate the basic process of OBS acquisition
- 动态规划(区间dp)
- Based on MCU, how to realize OTA differential upgrade with zero code and no development?
- Some common terms
- Xml的(DTD,xml解析,xml建模)
- Solve undefined reference to`__ aeabi_ Uidivmod 'and undefined reference to`__ aeabi_ Uidiv 'error
- Oracle withdraw permission & create role
- STL教程8-map
- R语言使用data.table包进行数据聚合统计计算滑动窗口统计值(Window Statistics)、计算滑动分组中位数(median)并合并生成的统计数据到原数据集中
猜你喜欢
软考中级软件设计师该怎么备考
Web security summary
The tutor put forward 20 pieces of advice to help graduate students successfully complete their studies: first, don't plan to take a vacation
Kubernetes 三打探针及探针方式
银泰百货点燃城市“夜经济”
Excel quick cross table copy and paste
用了这么久线程池,你真的知道如何合理配置线程数吗?
Encapsulate a koa distributed locking middleware to solve the problem of idempotent or repeated requests
MATLAB extrait les données numériques d'un fichier txt irrégulier (simple et pratique)
DS90UB949
随机推荐
Google Earth engine (GEE) - ghsl global population grid dataset 250 meter resolution
Driver development based on I2C protocol
多维度监控:智能监控的数据基础
简单工厂和工厂方法模式
FL Studio 20 unlimited trial fruit arranger Download
Phpcms prompt message page Jump to showmessage
抓包整理外篇fiddler———— 会话栏与过滤器[二]
ORACLE进阶(一) 通过EXPDP IMPDP命令实现导dmp
Incremental database backup - DB incr DB full
鸿蒙第四次培训
Nestjs配置服务,配置Cookie和Session
How to become a senior digital IC Design Engineer (1-5) Verilog coding syntax: operand
[OBS] configFile in ini format of OBS
Dynamic programming (interval DP)
CSRF
Abandon the Internet after 00: don't want to enter a big factory after graduation, but go to the most fashionable Web3
Arctangent entropy: the latest SCI paper in July 2022
R language uses grid of gridextra package The array function combines multiple visual images of the ggplot2 package horizontally, and the ncol parameter defines the number of columns of the combined g
[vtk] interpretation of source code comments of vtkwindowedsincpolydatafilter
JGG专刊征稿:时空组学