Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Architecture Metrics Reference
  • Workload Taxonomy for Architects
  • Architecture Glossary
  • Computer Architecture Cheatsheet
  • Pipeline Fundamentals14
  • Memory Hierarchy15
  • NoC and Interconnect Architecture6
  • Coherency and Memory Ordering9
    • Cache Coherence for the Architect
      • MESI States and the Single-Writer Invariant
      • Misses, Upgrades, and Evictions
      • Variants and Scaling: MOESI, MESIF, Snoop, Directory
      • ACE and CHI: An Honest Introduction
      • Sharing Costs and Coherence Triage
    • Memory Ordering Models
  • Performance Analysis9
  • Accelerator Architectures6
  • SoC Architecture Tradeoffs9
  • Architecture Interview Prep14
Loading lesson

‹Cache Coherence for the Architect
  1. Topics
  2. Computer Architecture
  3. Coherency and Memory Ordering
  4. Cache Coherence for the Architect
  5. MESI States and the Single-Writer Invariant

Computer Architecture · All levels

MESI States and the Single-Writer Invariant

The four MESI states, what each permits, and the single-writer invariant.

On this page

    Four states, two permissions

    Each line in each private cache sits in one of four states. The state crosses dirty/clean with exclusive/shared.

    State

    Dirty or clean

    Exclusive or shared

    Memory copy

    Store behavior

    M (Modified)

    Dirty

    Exclusive

    Stale; must write back

    Silent hit, already owner

    E (Exclusive)

    Clean

    Exclusive

    Clean

    Silent upgrade to M, no bus action

    S (Shared)

    Clean

    Shared

    Clean

    Needs upgrade with invalidations

    I (Invalid)

    No data

    No access

    Clean

    Needs ownership miss

    Memory is stale exactly when some cache holds the line in M. In every other combination the memory copy is clean.

    Only M holds write permission. E holds a promise of exclusivity that makes the next store silent.

    Legal edges and forbidden edges

    Twelve stable-state edges cover every hit, miss, upgrade, and eviction. Four edges are forbidden, and monitors check for them.

    From

    Event

    To

    Bus action

    I

    Read miss, no other sharer

    E

    BusRd, data from memory

    I

    Read miss, sharer present

    S

    BusRd, data from memory or sharer

    I

    Write miss

    M

    BusRdX, invalidate all copies

    S

    Read hit

    S

    None

    E

    Read hit

    E

    None

    M

    Read hit

    M

    None

    M

    Write hit

    M

    None

    E

    Write hit

    M

    None; silent upgrade

    S

    Write hit

    M

    BusUpgr plus one ack per sharer

    M

    Eviction

    I

    Writeback to memory

    E

    Eviction

    I

    None; line already clean

    S

    Eviction or remote invalidation

    I

    None

    Forbidden edge

    Why it is illegal

    Two caches in M on one line

    Two writers exist at once

    M beside S on one line

    A reader observes a dirty owner as clean

    E beside S, or two in E

    Exclusivity is broken

    M entered while a sharer stays valid

    The upgrade skipped invalidation

    Races need transient states such as IS, IM, and SM between request and acknowledgement. Their full treatment lives in the cache-coherency course; here the stable edges plus the forbidden list are the contract.

    Why the Exclusive state matters

    A clean read miss with no other sharer grants E instead of S. The later store then upgrades silently to M with no bus traffic.

    Without E, every write to clean private data would pay an invalidate round. E removes that cost for single-threaded phases.

    Common mistakes

    Common pitfall

    Treating E as a second dirty state. E is clean: memory already matches, eviction needs no writeback, and no other cache holds the line.

    Interview

    Likely probes: all four states with encoding, what makes memory stale, and silent versus invalidating upgrade.

    • Memory is stale exactly when some cache holds M.

    • E-to-M is silent; S-to-M collects one acknowledgement per sharer.

    • Name one forbidden edge and the monitor that would catch it.

    Check yourself A line is in E and the core stores to it. What bus action follows, and what state results?

    None follows. The line moves silently to M, and the memory copy becomes stale at that moment.

    Check yourself Two caches hold S and both store at once. What must the protocol enforce?

    Exactly one winner. One upgrade collects every acknowledgement and reaches M while the loser is invalidated; monitors must never see M beside S or two M copies.

    Related topics

    • Misses, upgrades, and evictions

    • Cache-coherency course

    Previous

    40 / 86

    Next: Misses, Upgrades, and Evictions

    Up next

    Up nextMisses, Upgrades, and Evictions

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Variants and Scaling: MOESI, MESIF, Snoop, Directory
    • ACE and CHI: An Honest Introduction
    • Sharing Costs and Coherence Triage