2011-04-20 103 views

回答

6

這裏是維基百科的簡短解釋coursey(http://en.wikipedia.org/wiki/Fork_bomb):

:()  # 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. 

基本上是一個遞歸函數,每次recusrive調用導致兩個更多的進程。所以進程的數量呈指數增長。