Fork bomb
≈ 1 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
A fork bomb (also called rabbit virus or hydra virus) is a denial-of-service (DoS) attack against a computer where a process continually replicates itself to deplete available system resources, slowing down or crashing the system due to resource starvation.
A fork bomb (also called rabbit virus or hydra virus) is a denial-of-service (DoS) attack against a computer where a process continually replicates itself to deplete available system resources, slowing down or crashing the system due to resource starvation. A classic example of a fork bomb is one written in Unix shell :(){ :|:& };: , dating back to at least 1999, which can be more easily understood as fork() { fork | fork & }; fork In it, a function is defined ( fork() ) as calling itself ( fork ), then piping ( | ) its result into itself, all in a background job ( & ). The code using a colon : as the function name is not valid in a shell as defined by POSIX, which only permits alphanumeric characters and underscores in function names. However, its usage is allowed in GNU Bash as an extension. The traditional C implementation (using the POSIX headers) is: include int main() { while (true) { fork(); } } This repeatedly calls the fork() function, duplicating the current process, in the header . Various forms of such a fork bomb have been created.
Text derived from https://en.wikipedia.org/w/index.php?oldid=1373594455 under CC BY-SA 4.0; modifications have been made.