Say, I have two threads A
and B
writing to a global Boolean variables fA
and fB
respectively which are initially set to <
Is it possible to observe the modifications on fA and fB in different orders in different threads C and D?
The basic idea of a lock "acquiring" the "released" state (and side effect history) of an unlock make that impossible: you promise to only access a shared object by acquiring the corresponding lock, and that lock will "synchronize" with all past modifications seen by the thread that did the unlock. So only one history, not only of lock-unlock operations, but of accesses to shared objects, can exist.