Question: Can anyone compile and execute three short attached C-programs and answer the question from the observation based on the output. So, run and identify differences.
Can anyone compile and execute three short attached C-programs and answer the question from the observation based on the output. So, run and identify differences. you need to understand and explain these differences.
Program #1: #include #include int main(){ /* fork a child process */ fork(); printf("after first fork(): %ld ", (long) getpid()); return 0; } Program #2: #include #include int main(){ /* fork a child process */ fork(); printf("after first fork(): %ld ", (long) getpid()); wait(); return 0; } Program #3: #include #include int main(){ /* fork a child process */ fork(); wait(); printf("after first fork(): %ld ", (long) getpid()); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
