(e) What will be the output of the following code segment at at lines A, B, C, and D? Assume that
actual process ids of the child and parent are 3608 and 3600, respectively. [4]
int main() {
pid_t pid, pid1;
pid = fork();
if (pid < 0) { /* error occurred */
fprintf(stderr, "Fork Failed");
return 1;
}
else if (pid == 0) {
pid1 = getpid();
printf("child: pid = %d",pid); /* A */
printf("child: pid1 = %d",pid1); /* B */
}
else {
pid1 = getpid();
printf("parent: pid = %d",pid); /* C */
printf("parent: pid1 = %d",pid1); /* D */
wait(NULL);
}
return 0;
}