JavaRush /Java Blog /Random EN /The most dangerous code
Dr-JohnZoidberg
Level 41
Киев

The most dangerous code

Published in the Random EN group
What piece of code would you say is the most dangerous ever written? There may be different opinions here, but many programmers agree that the danger lies in simplicity. That's why they name the classic fork bomb among the riskiest pieces of code. This is a program that endlessly creates copies of itself, and they, in turn, create their own copies, and so on until the memory runs out. Such a joke can be written by accident, but more often than not this cute little piece of code is created for sabotage. The classic fork bomb program (written in C) looks like this: If you have already completed lectures 3 and 4 of CS50, you understand all the words except fork=). So, fork() is a system call with the help of which the program creates its copies. Attention! We think that among our readers there will be lovers of experiments who will want to check with their own eyes whether this tiny program will help your computer. If you decide to try, we strongly recommend that you save all unsaved documents. We're serious. Most likely, the speed of resource consumption will surprise you =). #include int main() { while(1) fork(); }
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION