this program is used to create maximum no. of processes system is allowed to create
Ok fine but i didn't get the else part what is going in there
When i execute it my system hangs boot itself automatically??
Can someone please explain it how the following code works??
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
int main()
{
pid_t pid;
int i = 1;
for(;;)
{
pid = fork();
if(pid < 0)
printf("MAX no of concurrent process are %d\n",i);
if(pid == 0)
i++;
else
{
wait(0);
exit(0);
}
}
return 0;
}