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.
1. int X = 0;
2. void* printX(void* data) {
3. X = X + 4;
4. printf("thread %s %d \n",(char*)data,X);
5. X = X + 2;
6. }
7.
8. int main() {
9. pthread_t thread_id[ 2 ];
10. X++;
11. pthread_create(&thread_id[ 0 ], NULL, printX, "A");
12. X = X + 3;
13. pthread_create(&thread_id[ 1 ], NULL, printX, "B");
14. X = X + 2;
15. pthread_join(thread_id[ 0], NULL);
16. pthread_join(thread_id[ 1], NULL);
17. }
the minimum possible value of X printed by thread A is
the maximum possible value of X printed by thread A is
the minimum possible value of X printed by thread B is
the maximum possible value of X printed by thread B is