Question: Consider the following code segments running on two processors P1 and P2. Assume A, and B, are initially 0. Explain how an optimizing compiler might
Consider the following code segments running on two processors P1 and P2. Assume A, and B, are initially 0. Explain how an optimizing compiler might make it impossible for B to be ever set to 2 in a sequentially consistent execution model.

P1: A=1; A=2; While (B=0); P2: B=1; While (A 1); B= 2;
Step by Step Solution
3.50 Rating (167 Votes )
There are 3 Steps involved in it
As the question suggests an optimizing compiler could change the behavior of the code in such a way that it could theoretically prevent variable B fro... View full answer
Get step-by-step solutions from verified subject matter experts
