I need to create two child processes each of which calls execvp ater being forked, and the executables share POSIX semaphores between them.
Do I need to cr
Shared memory approach will also work here, only thing here is parent process has to initialise the shared memory. There seems one bug in this code instead of two child, parent function will fork 3 child process here. There should be break statement inside
if (pids[i] == 0) {
if (execl(CHILD_PROGRAM, CHILD_PROGRAM, NULL) < 0) {
perror("execl(2) failed");
exit(EXIT_FAILURE);
}
break; //this is required
}