I read from Effective Java that In the absence of synchronization the following sequence A below can be converted into sequence B by the virtual machine and this is called hoisting
. I also read somewhere that if variables are not declared as volatile instructions involving the variables can be reordered . Are hoisting and reordering the same thing?
while (!done) sequence A
i++;
if (!done)
while (true) sequence B
i++;
See Question&Answers more detail:os