首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何:(){:AC.26:&};:works

如何:(){:AC.26:&};:works
EN

Stack Overflow用户
提问于 2011-04-20 13:51:25
回答 2查看 239关注 0票数 1

可能重复: 这个叉子炸弹是怎么工作的?

嗨,

快速提问。

这个shell命令是如何工作的,为什么它获得了高达100%的cpu使用量?

代码语言:javascript
复制
: ( ) { : | : & } ; :
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-04-20 13:54:47

这是一个叉形炸弹

票数 2
EN

Stack Overflow用户

发布于 2011-04-20 14:00:51

以下是维基百科(炸弹)的简短解释:

代码语言:javascript
复制
:()      # define ':' -- whenever we say ':', do this:
{        # beginning of what to do when we say ':'
    :    # load another copy of the ':' function into memory...
    |    # ...and pipe its output to...
    :    # ...another copy of ':' function, which has to be loaded into memory
         # (therefore, ':|:' simply gets two copies of ':' loaded whenever ':' is called)
    &    # disown the functions -- if the first ':' is killed,
         #     all of the functions that it has started should NOT be auto-killed
}        # end of what to do when we say ':'
;        # Having defined ':', we should now...
:        # ...call ':', initiating a chain-reaction: each ':' will start two more.

基本上是一个递归函数,每次重复调用都会产生两个进程。因此,过程的数量呈指数增长。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5731435

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档