The MESI (Modified, Exclusive, Shared, Invalid) protocol is used for CPU caches to communicate and ensure they are all using the latest value for a cache line. When one CPU modifies a cache line value, all other CPUs subscribed to this cache line are kept alerted on the change to the cache line.
However, in all the literature I have read regarding MESI I haven't seen if there is any performance cost whilst the protocol communicates? Would this cost just be part of the x86 LOCK
prefix cost? I am fairly certain MESI can be used even when the x86 LOCK
prefix is not?
NB Intel actually uses the MESIF protocol- where F is an additional "Forwarding" state.
MESI protocol works by exchanging messages on the inter-CPU bus (however that bus is implemented). That bus has limited throughput capacity, so that one can saturate it by using atomic instructions.
This is why poorly written applications that needlessly use atomic instructions adversely affect an entire machine.