Consider the multi-threaded program below and choose the options that correctly minimum and maximum possible values of X printed by the thread A and B. To get points, you must show thread interleavings resulting in each of these outcomes in the text-box for the next problem. A lucky guess with an incorrect interleaving will get you 0 points.
int X = 0;
void* printX(void* data) {
X = X + 4;
printf("thread %s %d \n",(char*)data,X);
X = X + 2;
}
int main() {
pthread_t thread_id[ 2 ];
X++;
pthread_create(&thread_id[ 0 ], NULL, printX, "A");
X = X + 3;
pthread_create(&thread_id[ 1 ], NULL, printX, "B");
X = X + 2;
pthread_join(thread_id[ 0], NULL);
pthread_join(thread_id[ 1], NULL);
}
minimum possible value of X printed by thread A is
maximum possible value of X printed by thread A is
minimum possible value of X printed by thread B is
maximum possible value of X printed by thread B is