Easy
fork() return values
What value of pid does each process print?
main.cpp
#include <unistd.h>
#include <cstdio>
int main() {
pid_t pid = fork();
if (pid == 0) {
printf("child: pid=%d\n", pid);
} else if (pid > 0) {
printf("parent: pid=%d\n", pid);
} else {
perror("fork");
}
return 0;
}4 of 53 in Operating Systems