Wednesday, October 19, 2005

Fork bomb

Ever since I had heard about fork bombs (last semester Operating Systems course), I wanted to create one for myself and see its effect. Please don't try this if you don't want to waste your *nix system.



#include <sys/types.h>
#include <unistd.h>
int main() {
while(1)
fork();
return 0;
}


I ran it on my Gentoo system and it was brought to its knees in a few seconds. I couldn't open any new processes or even login in another terminal (well login is again a process, so I guess that was redundant). Couldn't even terminate the fork bomb by Ctrl+C. Ctrl+Alt+Del (reboot) also didn't work. So had to push the power off button.
It was pretty cool :D

No comments: