Friday, February 22, 2019

assembly - Is a memory barrier an instruction that the CPU executes, or is it just a marker?

I am trying to understand what is a memory barrier exactly.
Based on what I know so far, a memory barrier (for example: mfence) is used to prevent the re-ordering of instructions from before to after and from after to before the memory barrier.



This is an example of a memory barrier in use:



instruction 1
instruction 2

instruction 3
mfence
instruction 4
instruction 5
instruction 6


Now my question is: Is the mfence instruction just a marker telling the CPU in what order to execute the instructions? Or is it an instruction that the CPU actually executes like it executes other instructions (for example: mov).

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...