免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2690 | 回复: 9
打印 上一主题 下一主题

[系统管理] 请给个SHELL,能使劲消耗CPU但是不会引起大的IO [复制链接]

论坛徽章:
1
15-16赛季CBA联赛之吉林
日期:2016-07-02 18:10:16
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-03-13 16:17 |只看该作者 |倒序浏览
请给个SHELL,能使劲消耗CPU但是不会引起大的IO

准备做个测试,但是发现不知道这种SHELL怎么写

论坛徽章:
0
2 [报告]
发表于 2013-03-13 16:21 |只看该作者
@零七年的夏天

找个测试工具试吧!
  1. [root@Wed ~]# sysbench
  2. Missing required command argument.
  3. Usage:
  4.   sysbench [general-options]... --test=<test-name> [test-options]... command

  5. General options:
  6.   --num-threads=N            number of threads to use [1]
  7.   --max-requests=N           limit for total number of requests [10000]
  8.   --max-time=N               limit for total execution time in seconds [0]
  9.   --forced-shutdown=STRING   amount of time to wait after --max-time before forcing shutdown [off]
  10.   --thread-stack-size=SIZE   size of stack per thread [32K]
  11.   --init-rng=[on|off]        initialize random number generator [off]
  12.   --test=STRING              test to run
  13.   --debug=[on|off]           print more debugging info [off]
  14.   --validate=[on|off]        perform validation checks where possible [off]
  15.   --help=[on|off]            print help and exit
  16.   --version=[on|off]         print version and exit

  17. Compiled-in tests:
  18.   fileio - File I/O test
  19.   cpu - CPU performance test
  20.   memory - Memory functions speed test
  21.   threads - Threads subsystem performance test
  22.   mutex - Mutex performance test
  23.   oltp - OLTP test

  24. Commands: prepare run cleanup help version

  25. See 'sysbench --test=<name> help' for a list of options for each test.
复制代码

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
3 [报告]
发表于 2013-03-13 16:49 |只看该作者
while :
do
echo 2^2^20|bc &>/dev/null
done

论坛徽章:
0
4 [报告]
发表于 2013-03-13 22:24 |只看该作者
本帖最后由 xuhainanjing 于 2013-03-13 22:25 编辑

这个更酷
){ :& };:
直接敲进shell

怎么回事,变成表情了

论坛徽章:
0
5 [报告]
发表于 2013-03-13 22:25 |只看该作者
){ :& };:

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
6 [报告]
发表于 2013-03-13 23:04 |只看该作者
回复 5# xuhainanjing


放到code标签里面
  1. :(){ :|:& };:
复制代码

论坛徽章:
0
7 [报告]
发表于 2013-03-14 10:00 |只看该作者
本帖最后由 xuhainanjing 于 2013-03-14 10:01 编辑

回复 6# Shell_HAT
多谢,这个杀伤力很强的,不出几秒钟,你的主机就down了,


   

论坛徽章:
0
8 [报告]
发表于 2013-03-16 16:20 |只看该作者
Shell_HAT 发表于 2013-03-13 23:04
回复 5# xuhainanjing



求解释!!!!

论坛徽章:
0
9 [报告]
发表于 2013-03-16 17:28 |只看该作者
感谢伟大的Google
整明白了,原来:在这里其实是个函数名,太具有欺骗性啦。所以这个还可以改成.(){ .|.& };.蒙混过关,但其实是
myfunction()
{
myfunction|myfunction&
}
myfunction
伟大的unix
伟大的shell

论坛徽章:
5
丑牛
日期:2014-01-21 08:26:26卯兔
日期:2014-03-11 06:37:43天秤座
日期:2014-03-25 08:52:52寅虎
日期:2014-04-19 11:39:48午马
日期:2014-08-06 03:56:58
10 [报告]
发表于 2013-03-18 09:25 |只看该作者
Shell_HAT 发表于 2013-03-13 16:04
回复 5# xuhainanjing
这个酷
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP