MSI vs MESI vs MOESI: Key Differences Explained
MSI, MESI and MOESI are protocols that attach a state to each line held in each cache of a multicore system so that data at the same address never becomes inconsistent. MSI is the basic form with only three states: Modified, Shared and Invalid. MESI adds Exclusive (held only by this cache, with the same contents as memory), which saves bus traffic when writing data that no other core holds. MOESI further adds the Owned state, which allows modified data to be shared with other caches without writing it back to memory.
| Aspect | MSI | MESI | MOESI |
|---|---|---|---|
| Number of states | Three (M, S, I) | Four (M, E, S, I) | Five (M, O, E, S, I) |
| Modified (M) | Held only by this cache; contents differ from memory | Same | Same |
| Shared (S) | Other caches may also hold it. Contents match memory | Same | Other caches may also hold it. Contents may differ from memory (when a line in O state exists) |
| Exclusive (E) | None | Held only by this cache; contents match memory | Present (same as MESI) |
| Owned (O) | None | None | Contents differ from memory, but other caches share it in S. Responsible for writing back to memory |
| When reading data no other core holds | Enters S state | Enters E state | Enters E state |
| When then writing to that data | To change from S to M, issues a request on the bus or similar to invalidate other copies | Changes from E to M without any communication | Changes from E to M without any communication |
| When another core reads an M line | Writes back to memory; both become S | Writes back to memory; both become S (the data may also be passed directly from the cache) | Passes the data without writing back; this cache becomes O and the other becomes S |
| Write-back to memory | Occurs each time a modified line is read by another core | Occurs each time a modified line is read by another core | Can be deferred until the O line is evicted |
| State bits and complexity | 2 bits. Simplest | 2 bits. Moderate | 3 bits. Most complex |
Figures are typical orders of magnitude and vary by process generation and product.