The simple part of the code is:
#include <stdio.h>
#include <string.h>
main()
{
printf("Process");
fork();
fork();
return 0;
}
From my understanding of fork (), after executing this code we will have 3 child processes and one parent process. Also, whenever we call fork (), execution should begin with a statement immediately after the fork () statement. Therefore, according to me, “Process” should be printed only once. But in my output, the process is printed 4 times. How is this possible?
source
share