Question: Consider the following code segments running on two processors P1 and P2. Assume A and B are initially 0. a. If the processors adhere to

Consider the following code segments running on two processors P1 and P2. Assume A and B are initially 0.

P1: While (B=0); A=1; P2: While (A=0); B = 1;

a. If the processors adhere to sequential consistency (SC) consistency model. What are the possible values of A and B at the end of the segments? Show the statement interleaving supporting your answer(s).

b. Repeat (a) if the processors adhere to the total store order (TSO) consistency model.

P1: While (B=0); A=1; P2: While (A=0); B = 1;

Step by Step Solution

3.46 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets analyze the given code segments running on two processors P1 and P2 for both the Sequential Consistency SC and Total Store Order TSO memory models The code for P1 is While B 0 A 1 And the code for P2 is While A 0 B 1 a Sequential Consistency SC Sequential consistency is a memory model ... View full answer

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 Computer Architecture Questions!