I have a proposal to create a process with pipes and i have build 20 children. It works! But the most complicated matter is to fullfil the following requirements:
I have to create a grandson for each children with pair number (c.e. 2nd, 4rth, 6th,..)and finally i have to create a great-granson for each grandson which is divisible by 6. (c.e. 6th grandson, 12th, 18th)
I'm sorry but i'm novice with unix and concurrent proceses. Here it is my simply code as basis to start.
The code:
#include <unistd.h>
#include <sys/types.h>
main(){
pid_t pid;
int i, n=20;
for (i=0; i<n; i++) {
pid=fork();
if (pid == 0) break;
}
printf(“\n The father in the process %d is %d”, getpid(),getppid());
}