How many number of processes will be created in the following program? Prove your answer by making a replica code that will count no of processes created.
int main()
{
fork();
fork();
fork();
fork();
}
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
pid_t pid = fork();
pid = fork();
pid = fork();
if (pid == 0)
{
fork();
}
fork();
return 0;
}
Comments
Leave a comment