当前位置:网站首页>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

边栏推荐
- phpcms 提示信息页面跳转showmessage
- 鸿蒙第三次培训(项目实训)
- Software testing weekly (issue 78): the more confident you are about the future, the more patient you are about the present.
- PHP server interacts with redis with a large number of close_ Wait analysis
- Programmers' entrepreneurial trap: taking private jobs
- Multi dimensional monitoring: the data base of intelligent monitoring
- Matlab extracts numerical data from irregular txt files (simple and practical)
- C语言 AES加解密
- Numpy np.max和np.maximum实现relu函数
- 鸿蒙第四次培训
猜你喜欢
Kibana - installation and configuration of kibana
Arctangent entropy: the latest SCI paper in July 2022
Xml的(DTD,xml解析,xml建模)
Google Earth engine (GEE) - ghsl global population grid dataset 250 meter resolution
PHP基础
[OBS] configFile in ini format of OBS
Encapsulate a koa distributed locking middleware to solve the problem of idempotent or repeated requests
抓包整理外篇fiddler———— 会话栏与过滤器[二]
用了这么久线程池,你真的知道如何合理配置线程数吗?
鸿蒙第四次培训
随机推荐
ASP.NET-酒店管理系統
The world's most popular font editor FontCreator tool
phpcms 提示信息页面跳转showmessage
FL Studio 20无限试用版水果编曲下载
AI模型看看视频,就学会了玩《我的世界》:砍树、造箱子、制作石镐样样不差...
[VTK] vtkPolydataToImageStencil 源码解读
STL教程8-map
Processes and threads
2022 东北四省赛 VP记录/补题
This article explains the complex relationship between MCU, arm, MCU, DSP, FPGA and embedded system
Numpy np.max和np.maximum实现relu函数
P3250 [hnoi2016] Network + [necpc2022] f.tree path tree section + segment tree maintenance heap
Google Earth engine (GEE) -- when we use the front and back images to make up for the interpolation effect, what if there is no effect?
How to: configure ClickOnce trust prompt behavior
Redis things
基于turtlebot3实现SLAM建图及自主导航仿真
Incremental database backup - DB incr DB full
How to make others fear you
外插散点数据
PHP server interacts with redis with a large number of close_ Wait analysis