Fork Bomb - Implementation

Implementation

Fork bombs operate both by consuming CPU time in the process of forking, and by saturating the operating system's process table. A basic implementation of a fork bomb takes the following form:

set running to true while running is true create copy of running process end

In Unix-like operating systems, fork bombs are generally written to use the fork system call. As forked processes are also copies of the first program, once they resume execution from the next address at the frame pointer, they also seek to create a copy of themselves; this has the effect of causing an exponential growth in processes. As modern Unix systems generally use copy-on-write when forking new processes, a fork bomb generally will not saturate such a system's memory.

Microsoft Windows operating systems do not have equivalent functionality to the Unix fork system call; a fork bomb on such an operating system must therefore create a new process instead of forking from an existing one.

Read more about this topic:  Fork Bomb