Question: EASY unix/C assignment: Review this code and answer the 4 questions about them afterwards.. Below is a simple example, fork.c, involving the fork() call. /*
EASY unix/C assignment:
Review this code and answer the 4 questions about them afterwards..
Below is a simple example, fork.c, involving the fork() call. /* Slight modification of Richard Stevens example from "Advanced Programming in the UNIX Environment" */ #include
QUESTIONS:
1. What are the process ids for the child and the parent processes? 2. Which parts are done by both processes, by the child only, and by the parent only? 3. Why does only the child process increment the two variables, i.e., globalVar and localVar? Why are both of them affected? 4. Which process(es), child and/or parent, execute(s) the sleep command? Why is that?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
