Question: Consider the following code and answer the following questions. #include int x, y: /* a global variable */ int main() { int pid: pthread_t tid:

Consider the following code and answer the following questions. #include int x, y: /* a global variable */ int main() { int pid: pthread_t tid: pthread_attr_t attr: x = 4: y = 8: pid = fork(): if (pid == 0) { pthread_attr_init(&attr): pthread_creat(&tid, &attr, runner, NULL): pthrad_Join(tid, NULL): printf("x is %d, y is %d ", x y): /* (A) */ } else if (pid > 0) { wait(NULL): y = y/x: printf (x is %d, y is %d ", x(y): /* (B) */ } } /* end of main */ void *runner(void *param) { x = y/4: x = x*y: Pthread_exit(0): } Assume a process will be successfully created. What would be the value of x and y at (A) & (B)? Justify your
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
