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

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
    • Why Coherence
    • Invalidate or Update
    • MSI, MESI and MOESI
    • Snooping or Directory
    • Ownership and Forwarding
    • Coherence and Consistency
    • I/O Coherence and Cache Maintenance
    • Protocols Compared: Shared State and Coherence
    • Drills: Shared State and Coherence
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 13: Shared State and Coherence
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 13: Shared State and Coherence
  4. Drills: Shared State and Coherence

Part 13 · Shared State and Coherence · All levels

Drills: Shared State and Coherence

Interview questions, a whiteboard exercise and a ten-question checkpoint for Part 13.

On this page

    Answer each question out loud before opening it. If you miss more than three in the checkpoint, revisit the lessons linked at the end.

    Interview questions

    Check yourself Why do multicore systems need coherence?

    Private caches hold copies that go stale when another core writes; coherence enforces single-writer, multiple-reader and the latest-value rule per location.

    Check yourself Why invalidate rather than update?

    Writes come in runs; invalidation pays once per run, update pays per write.

    Check yourself What does E add to MSI?

    Knowledge that the copy is the only one, so the first write is silent; it halves bus traffic for private data.

    Check yourself What does O add to MESI?

    Dirty data can be shared without writing it back; the owner supplies it.

    Check yourself When does snooping stop scaling?

    When broadcast traffic and lookups to many caches dominate; directories message only holders.

    Check yourself What is a three-hop miss?

    Requester to home, home forwards to owner, owner sends data to requester.

    Check yourself Is a coherent system sequentially consistent?

    No: coherence orders one location; the memory model governs cross-location order.

    Check yourself How do you keep DMA consistent with caches?

    I/O coherence in hardware, or clean before device reads and invalidate around device writes, with barriers and line-aligned buffers.

    Whiteboard exercise

    Task. A 32-core chip in 8 clusters of 4 shares a last-level cache. Design how coherence is maintained within and between clusters, how a dirty miss to another cluster is served, and how a non-caching DMA engine and a caching accelerator attach.

    Check yourself Open a model answer

    Within a cluster: snooping among 4 caches (cheap broadcast) with MESI or MOESI. Between clusters: a directory or snoop filter at the shared cache's home slices, tracking which clusters hold each line, so requests snoop only those clusters. Home slices order requests per address. A dirty miss to another cluster: requester to home slice, home forwards to the owning cluster, the owner sends data directly to the requester (three hops), and updates the home; O or Shared Dirty states avoid writebacks for dirty sharing. Size the snoop filter for the combined cache capacity with margin to avoid back-invalidation thrash. DMA engine: I/O coherent (ACE-Lite-style) requests to the home, which snoops holders: reads get dirty data, writes invalidate. Accelerator with a cache: a fully coherent agent tracked by the directory like a cluster. Define race rules for writebacks crossing forwards, and verify SWMR with a model checker on the protocol tables.

    Checkpoint: ten questions

    Check yourself 1. State the SWMR invariant.

    At any time a location has one writer or any number of readers, never both.

    Check yourself 2. What is false sharing?

    Independent variables in one line make it bounce between caches on every write.

    Check yourself 3. Producer writes 10 times, 2 consumers read once. Bus transactions per round, invalidate versus update?

    Invalidate 1 + 2 = 3; update 10.

    Check yourself 4. Which state allows a silent write?

    M (already) and E (becomes M).

    Check yourself 5. What does MESIF's F state do?

    Designates one clean sharer to answer requests.

    Check yourself 6. What orders requests in a directory protocol?

    The line's home node.

    Check yourself 7. What is back-invalidation?

    Evicting a directory or snoop-filter entry forces caches holding that line to invalidate it.

    Check yourself 8. Who owns a clean line shared by three caches under MESI?

    Memory.

    Check yourself 9. In the flag-and-data litmus test, can a weak machine read old data without barriers?

    Yes.

    Check yourself 10. Why invalidate a DMA receive buffer after the transfer too?

    The CPU may have speculatively refetched lines during the DMA.

    Revisit

    • 13.1 Why Coherence

    • 13.2 Invalidate or Update

    • 13.3 MSI, MESI and MOESI

    • 13.4 Snooping or Directory

    • 13.5 Ownership and Forwarding

    • 13.6 Coherence and Consistency

    • 13.7 I/O Coherence and Cache Maintenance

    Keep going

    Next: Part 14: Security and Isolation. Who is allowed to ask?

    Previous

    188 / 234

    Next: Part 14: Security and Isolation

    Up next

    Up nextPart 14: Security and Isolation

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Why Coherence
    • Invalidate or Update
    • MSI, MESI and MOESI