Question: For the multi - threaded program below, what are all the valid outputs ( printed value of A ) for a sequentially consistent execution of
For the multithreaded program below, what are all the valid outputs printed value of A for a sequentially consistent execution of the program? Before these threads start executing, A and B are both initialized to zero. Assume that each line of code below corresponds to one assembly instruction.
Thread
B;
A;
Thread
if BA
then A AB;
print A:
What are possible valid outputs if the code in each thread is encapsulated within lock and unlock statements as shown below again assuming a sequentially consistent processor
Thread
lockL;
B;
A ;
unlockL;
Thread
lockL;
if BA then
A A B;
print A;
unlockL;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
