01 - Java-
01 - Java-
1.
2.
2-0 CPU
2-1 CPU - MESI
2-2 CPU-
2-3 JavaJava Memory ModelJMM
2-4
1.
“”
:
( High Concurrency)
""
2.
CPU-
CPU-
JAVA
2-0 CPU
1) CPU
BUS
2)
" "
CPU
Bus...
L2 Cache
CPUCPU Cache
CPU
CPU Cache
CPU CPU
cache CPU
cpu-> cache-> memory).
CPU Cache
1)
2)
2-1 CPU - MESI
CacheCacheMESI
CacheCache line2dirtyvalidCacheMemory(
)()
MESI
M: Modified CPU
CPU
E
EExclusive CPU
CPUSCPUM
SShare CPU
CPUCPUI()
IInvalid CPU
M(Modified)E(Exclusive)Cache lineMdirty
()Eclean()
S(Shared)Cache lineCoreCachecleanCache
I(Invalid)Cache line
CPU-MESI
https://blog.csdn.net/qq_28867949/article/details/79991422
https://blog.csdn.net/qq_28867949/article/details/79991676
MESICacheCache(snoop)Cache
Cache line4
MESI
local read
local write
remote read
remote write
MESI:
M: Modified CPU
CPU
E
EExclusive CPU
CPUSCPUM
SShare CPU
CPUCPUI()
IInvalid CPU
""
CacheL1 CacheCPU
L1 CacheCacheCache"C
ache
line"CacheCacheL1 C
ache
L1 CacheL2 CacheL3 CacheL1 Cache
L2L1L3L2
AB A
MESI16