2024年12月14日星期六

mesi protocol

For any given pair of caches, the permitted states of a given cache line are as follows:

M E S I
M X X X O
E X X X O
S X X O O
I O O O O
Curstate Operation NextState SOther Core
INVALID Read case EXCLUSIVE if other core is INVALID INVALID (No operation)

case SHARED if other core contains data SHARED (no operation)
MODIFIED -> Flush -> SHARED
EXCLUSIVE -> SHARED
INVALID Write MODIFIED INVALID (no operation)
SHARED -> INVALID
MODIFIED -> Flush -> INVALID
EXCLUSIVE -> INVALID
EXCLUSIVE Read EXCLUSIVE INVALID (No operation)
EXCLUSIVE Write MODIFIED INVALID (No operation)
SHARED Read SHARED INVALID (no operation)
SHARED (no operation)
SHARED Write MODIFIED INVALID (no operation)
SHARED -> INVALID
MODIFIED Read MODIFIED INVALID (No operation)
MODIFIED Write MODIFIED INVALID (No operation)

Reference: https://github.com/Yefei100/Cache_coherence_protocol/blob/master/main.cc