Question: (14) Consider the following UNIX C program (Program A): //PROCESS PROGRAM //To compile: g++ //To Run: ./a.out #includesys/types.h> #include #include #include stdio.h void function (int

 (14) Consider the following UNIX C program (Program A): //PROCESS PROGRAM

(14) Consider the following UNIX C program (Program A): //PROCESS PROGRAM //To compile: g++ //To Run: ./a.out #includesys/types.h> #include #include #include stdio.h void function (int value); int sum = 0 int main (void int status; int pid= waitpid ( fork(), &status, 0); if (pid 0) { parent sum++ else { child function (fork ()); % n", sum ) ; printf("Sum : return 0; void function (int pArg) int status; if (pArg != 0) { CHILD waitpid (pArg, &status , 0); sum++; (a) Give the output for the above code. (b) How many processes were created

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!