1 #include <stdlib.h> 2 #include <unistd.h> 3 #include <sys/wait.h> 4 5 int main(int argc, char *argv[]) 6 { 7 if (fork() == 0) { 8 write(1, "child\n", 6); 9 } else { 10 wait(0); 11 write(1, "parent\n", 7); 12 } 13 14 exit(0); 15 } 16