Question: 4. Threads Use the pseudo code below for this question. Note that it is using the Linux implementation of threading (i.e., PTHREADs) as a basis

 4. Threads Use the pseudo code below for this question. Note

4. Threads Use the pseudo code below for this question. Note that it is using the Linux implementation of threading (i.e., PTHREADs) as a basis for the question As in question 3, the code will not compile, but you may find it useful to code up a short example to check your answers. what is the value of the variable value" at: a. (5 pts) LINE D b. (5 pts) LINE E c. (5 pts) LINE F int value 0; void *runner(void *param); /*thread*/ int main(int argc, char *argvl) pid t pid; pthread r tid pthread_attr attr; pid fork() f (pido) /*child process*/ value -value10; pthread attr_init (&attr) pthread create (tid,&attr, runner, NULL); pthread _join(tid, NULL); printf("CHILD: value-96d, value); /*LINE D*/ Else if (pid>0) /*parent process/ wait (NULL); printf ("PARENT: value = %d, value); /*LINEE"/ Void runner (void *param) value value+ 5; printf("CHILD: value = %d, value); LINE F pthread_exit(0); 4. Threads Use the pseudo code below for this question. Note that it is using the Linux implementation of threading (i.e., PTHREADs) as a basis for the question As in question 3, the code will not compile, but you may find it useful to code up a short example to check your answers. what is the value of the variable value" at: a. (5 pts) LINE D b. (5 pts) LINE E c. (5 pts) LINE F int value 0; void *runner(void *param); /*thread*/ int main(int argc, char *argvl) pid t pid; pthread r tid pthread_attr attr; pid fork() f (pido) /*child process*/ value -value10; pthread attr_init (&attr) pthread create (tid,&attr, runner, NULL); pthread _join(tid, NULL); printf("CHILD: value-96d, value); /*LINE D*/ Else if (pid>0) /*parent process/ wait (NULL); printf ("PARENT: value = %d, value); /*LINEE"/ Void runner (void *param) value value+ 5; printf("CHILD: value = %d, value); LINE F pthread_exit(0)

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!