This seems like the normal use of fork()
, basically. Here's some pseudocode:
// start in process 3
int pid = fork();
if (pid == 0) {
int pid2 = fork();
if (pid2 == 0) {
// process 1
} else {
// process 2
}
} else {
// process 3
}