Question: a concurrent proble ( with multiple threads ) look like this: int counter = 1 0 0 2 ; void * worker ( void *
a concurrent proble with multiple threads look like this:
int counter ;
void workervoid arg
counter;
return NULL;
int main int argc, char argv
pthreadt p p;
pthreadcreate&p NULL, worker, NULL;
pthreadcreate&p NULL, worker, NULL;
pthreadjoin&p NULL;
pthreadjoin&p NULL;
printfd
counter;
return ;
Assuming pthread create and pthread join all work as expected ie they don't return an error what are the possible outputs?
Please justify your answers
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
