CodePudding user response:
The premise, the compiler and the processor must obey the rules of the rearrangement, at the same time memory barrier is hardware, operating system or the JVM, the last layer of concurrent support, then down is to provide the support of the hardware; Up is the operating system or the JVM to memory barriers of all kinds of packaging, memory barrier is a kind of standard, the manufacturer may adopt different implementations, multi-core processors to use memory barrier instruction to ensure consistency,