liveBook · Manning

Cache line

As explained in Learn Concurrent Programming with Go

A cache line is a block-sized unit of memory storage that a cache transfers and tracks as a copy of main memory.

A cache line is a block-sized unit of memory that a processor cache transfers and tracks as a copy of main memory. When one thread updates shared data, another processor may still hold an older copy of the same cache line. section 3.1

Shared-memory updates expose several cache-line behaviors:

  • Write-through mirrors an updated cache value back to main memory, but another CPU cache may still retain an outdated copy. section 3.1
  • Caches can listen for bus update messages and either apply the change or invalidate the affected cache line. section 3.1
  • Invalidation forces a later read to fetch a fresh copy from memory, while increasingly many processors make coherence more complex and costly. section 3.1
Figure 3.4 Updating shared variables in an architecture with caches

Follow the figure to visualize shared-variable updates across processor caches. section 3.1

How Learn Concurrent Programming with Go covers it

How deep it goes
Traces cache copies, write-through, bus notifications, invalidation, and the scalability limit called the coherency wall.
Examples
Uses shared-variable updates, two processor caches, bus messages, and cache-line invalidation as visual examples.
What it assumes
Assumes familiarity with threads, shared variables, processor caches, and main memory.
What you can do after
Understand how invalidation helps processors obtain updated shared values and why coherence can constrain scaling.
How it connects
Connects cache lines with main memory, processor caches, memory sharing, and cache-coherency protocols.

Also explained in

Compare how 4 books explain cache line →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Concurrent Programming with Go. The section links point to the parts of the book it draws on.