Question: [ Bonus 6 points ] Consider the following program ( the included headers are removed to save space ) . There are exactly four different

[Bonus 6 points] Consider the following program (the included headers are removed to save space). There are exactly four different possible values at Line A. Fill in the four blanks all the four possible values in the increasing order.
```
x =500;
pthread_mutex_t lock;
void* increase(void *arg){
pthread_mutex_lock(&lock);
x +=600;
pthread_mutex_unlock(&lock);
printf("%d
", x); //A [
}
main(){
pid_t pid;
pthread_t t1, t2;
int y =700;
pid = fork();
if (pid ==0){
x *=3;
y *=3;
pthread_create(&t1, NULL, increase, NULL);
pthread_create(&t2, NULL, increase, NULL);
pthread_join(t1, NULL);
pthread_join(t2, NULL);
return 0;
} else {
x /=2;
y /=2;
pthread_create(&t1, NULL, increase, NULL);
pthread_create(&t2, NULL, increase, NULL);
pthread_join(t1, NULL);
pthread_join(t2, NULL);
return 0;
}
}
```
Line A: Smallest Possible Value
type your answer...
Line A: 2nd Smallest Possible Value type your answer...
Line A: 3rd Smallest Possible Value type your answer...
Line A: Largest Possible Value
type your answer...
[ Bonus 6 points ] Consider the following program

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 Programming Questions!