Question: 2. Understand the following code and answer the questions below. ifnelude pthread.h> * Include int value =0; int 512E=4; void *runner(void *param) ; / the

2. Understand the following code and answer the questions below. ifnelude pthread.h> * Include int value =0; int 512E=4; void *runner(void *param) ; / the thread */ int main(int argc, char +argvi]) ( pid t pid; / LINE A/ pthread t tid; pthread_attr_t attr; pthread_attr_init (6attr); pthread create (stid, sattr, runner, NuLL): pthread join(tid, NuLL) : Pthread Jin (tid, NULL) : pid = fork( ) if (pid =0 ) l/ child process / value +=3; 1 printf ("value =8d, value) ;/ LINE C/ else if (pid >0) i (/ parent process wait (NULL): Printf ("value =8d "value) ;/+ LINE P / l void * Iunner (void "param) I for (int i=0;1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
