Question: The following question asks you to consider a C program fragment. Threads T1 and T2 con- currently run in the same address space and complete

The following question asks you to consider a C program fragment. Threads T1 and T2 con- currently run in the same address space and complete the functions with corresponding names. This question asks you about the state of the process after both threads have com- pleted. Note that x is allocated in the static data segment; you may treat it as if it is on the heap, and assume that it is an aligned 32-bit word. int x = 0; void T1() { x = x + 1; } void T2() { int r1 = x; } 48. What value(s) could r1 have when T2() completes? Select any that apply: (a) o (b) 1 (c) 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
