Assuming the Java memory model, (a) Explain why it is not sufficient in Figure 13.11 to label

Question:

Assuming the Java memory model,

(a) Explain why it is not sufficient in Figure 13.11 to label X and Y as volatile.

(b) Explain why it is sufficient, in that same figure, to enclose C’s reads (and similarly those of D) in a synchronized block for some common shared object O.

(c) Explain why it is sufficient, in Example 13.31, to label both inspected and X as volatile, but not to label only one.

Figure 13.11:

Initially: X = Y = 0 Core A: Core B: X:= 1 Y:= 1 Core C: Core D: cx := X dy := Y cy := Y dx := X

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: