When code contains a data race, counterintuitive results are often possible.Several mechanisms can produce the reordering in Table 17.2.
In addition, the memory hierarchy of the architecture on which a Java Virtual Machine implementation is run may make it appear as if code is being reordered.
This provides a great deal of freedom for the implementor to perform a myriad of code transformations, including the reordering of actions and removal of unnecessary synchronization.
The semantics of the Java programming language allow compilers and microprocessors to perform optimizations that can interact with incorrectly synchronized code in ways that can produce behaviors that seem paradoxical.
That order does not have to be consistent with other orderings, but the thread must behave as though those events occurred in that order.
For example, if a thread The above specifications allow us to determine several properties having to do with the interaction of waits, notification, and interruption.