Understand the classification of reordering

  1. Compiler reordering: If the statements have no sequential dependencies, the compiler can re-adjust the execution order of the statements in order to optimize performance.
  2. CPU instruction reordering: At the instruction level, multiple instructions without dependencies are executed in parallel.
  3. CPU memory reordering: The CPU has its own cache, and the order of execution of instructions and the order of writing to main memory are not completely consistent.

Guess you like

Origin blog.csdn.net/weixin_38106322/article/details/111052176