Question: Explain the image in details. fork() / exec() Example fork() int child_pid; foo as P1 switch (child_pid = fork ()) { case -1: perror (fork)

Explain the image in details.
fork() / exec() Example fork() int child_pid; foo as P1 switch (child_pid = fork ()) { case -1: perror (fork") exit (EXIT_FAILURE); // or recover foo as P1 parent case 0: // You are in the child execlp (echo", hello, world!, NULL); perror (execlp"); exit (EXIT_FAILURE); // or recover (foo as P2 exec("bar") default: // You are in the parent // No zombies! waitpid (child_p, ...); foo as P1 bar as po parent
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
