2020-09-29: Introduce the volatile function.

Fu Ge's answer 2020-09-29: #福大Architects Daily One Question#

The functions are as follows:
1. The memory is visible.
2. Reordering of instructions is prohibited.

The implementation is as follows:
1.
ACC_VOLATILE at the bytecode level

2.
The read and write of the volatile memory area at the JVM level are barriers

StoreStoreBarrier
volatile write operation
StoreLoadBarrier

LoadLoadBarrier
volatile 读操作
LoadStoreBarrier

3. OS and hardware level
hsdis-HotSpot Dis Assembler
windows lock instruction implementation | MESI implementation


comment

Guess you like

Origin blog.csdn.net/weixin_48502062/article/details/108875279