惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
Spread Privacy
Spread Privacy
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
腾讯CDC
P
Privacy International News Feed
Webroot Blog
Webroot Blog
J
Java Code Geeks
爱范儿
爱范儿
A
About on SuperTechFans
S
Secure Thoughts
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Latest
Security Latest
Forbes - Security
Forbes - Security
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
量子位
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 聂微东
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs

博客园 - killkill

jar 冲突、class 冲突的检测脚本 Oracle User Calls 和 Executions 两个概念的区别 使用 dbms_xplan.display 按照 plan_hash_value 查执行计划的方法 oratop 各个指标项说明 [转] sql_id VS hash_value lsattr/chattr [转]节约内存:Instagram的Redis实践 [原]佛山-杭州自驾路书 [原] insert into … on duplicate key update / replace into 多行数据 [摘] python url decoder 一条霸气的分析binlog的命令 一句命令完成MySQL的数据迁移(轻量级) [转]Linux下SSH Session复制 MySQL重复记录删除 使用Screen抵御杯具 [摘]Oracle 11g Flashback_transaction_query的undo_sql为空? Duplicate Active Database 遇到 ORA-01017 invalid username/password [摘]如何抓住蝴蝶效应中的那只蝴蝶 [原]将Oracle 中的blob导出到文件中
使用taskset命令来限制进程的CPU
killkill · 2012-04-08 · via 博客园 - killkill

      常常感觉系统资源不够用,一台机子上跑了不下3个比较重要的服务,但是每天我们还要在上面进行个备份压缩等处理,网络长时间传输,这在就很影响本就不够用的系统资源;

      这个时候我们就可以把一些不太重要的比如copy/备份/同步等工作限定在一颗cpu上,或者是多核的cpu的一颗核心上进行处理,虽然这不一定是最有效的方法,但可以最大程度上利用了有效资源,降低那些不太重要的进程占用cpu资源;

      taskset就可以帮我们完成这项工作,而且操作非常简单;

      该工具系统默认安装,rpm包名util-linux

      借助一个例子说明,借助以前写过的一个消耗CPU的脚本 原]消耗CPU资源的shell脚本 ,将一台16个CPU的机器上其中4个CPU的资源耗尽:

image

      使用 top 命令能看到4颗CPU跑满的效果:

image      现在可以使用 taskset 命令调整这些进程所使用的CPU了:

taskset -cp 1  25718
taskset -cp 3  25720
taskset -cp 5  25722
taskset -cp 7  25724

      在top中再看看效果:

image       哈哈,CPU的使用得到调配了,同样我们可以使某个进程仅使用其中几个CPU:

taskset -cp 1,2  25718

      更详细的信息可以用 man taskset 查看。