Question: 4 . ( 2 0 % ) This problem is related Memory Consistency. Consider the following code segments executed by three threads. Thread P 1

4.(20%) This problem is related Memory Consistency. Consider the following code segments executed by three threads.
Thread P1
Therad P2
Thread P3
a =1
print(b,c)
0=1
C=1
print (a,c)
print (a, b)
Assume that initially all variables are set to zero. Consider that we are using Sequential Consistency.
a). Is it possible to see an output of 11 print(b,c)
11 print(a,c)
11print(a,b)
printed by the 3 print statements?
If this is possible, show an interleaving of the instructions from the 3 threads that produces this
output.
b). Is it possible to see an output of 01 print(b,c)10 printa,c)00 print(a,b)
If this is possible, show an interleaving of the instructions from the 3 threads that produces this output.
c). Show at least 3 possible correct outputs that are possible using Sequential Consistency.

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