Version 4 of fork bomb

Updated 2003-06-04 16:53:25

A fork-bomb is a good test of a Unix-like system. You will probably want kill_all.tcl if you want to test it out. If your system fails to work even as root after starting it then you have problems...

One way of doing it in sh is:

 #!/bin/sh
 $0 &
 exec $0

Another way in C is:

 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>

 int main () {
        while (1) {
                fork ();
        }
        return EXIT_FAILURE;
 }

Jacob Levy 2003-06-02 I think this was probably written by GPS.

This is also an example of a DoS attack.