Wednesday, February 1, 2012

Fork Bomb: A simple bomb that makes you restart

Below is the few lines of code in C. It creats a Bomb called Fork Bomb.

Its just a few lines but it is sufficient to spawn infinitely many child processes. Each child again spawns infinite children. This continues.. and your system cries. Unable to take handle those many processes, your system gets slow, slower and finally stops responding. You got to restart your system.

Warning! You will loose your unsaved data. Also don't make any pranks out of it.
int main(){
    while(1)
        fork();
}

2 comments:

  1. Hello
    My name is Mantri "the threadman". I love processes and threads.

    ReplyDelete
    Replies
    1. nishikar! If you love processes so much, why don't you
      fork yourself. There will be child nishikar.

      Delete