C example:
#include <stdio.h> int main() { while(1) fork(); }
To compile:
$ clang bomg.c
Python example:
import os while True: os.fork()
How to prevent it, use RCTL for example in a jail:
$ rctl -a jail:myJail:maxproc:deny=50