{
  "schemaVersion": 1,
  "id": "atlas-lesson-coherence-numa",
  "title": "Cache coherence and NUMA placement",
  "category": "learning",
  "format": "Atlas lesson",
  "description": "Keeps shared cache lines consistent while preserving awareness of physical memory location.",
  "canonicalUrl": "https://semiaifoundry.com/learn/atlas/coherence-numa/",
  "publishedDate": null,
  "revisionDate": "2026-10-07",
  "author": null,
  "topic": "Processing architectures",
  "series": null,
  "license": null,
  "rightsUrl": "https://semiaifoundry.com/ai-atlas/licenses.html",
  "version": "1.3.0",
  "status": "Published educational lesson",
  "evidenceScope": "Topology illustrations omit protocol state details. Local-versus-remote numbers are invented for calculation, not measurements of a named CPU.",
  "contentCoverage": "published-lesson",
  "artifactUrl": "https://semiaifoundry.com/ai-atlas/lesson-data/coherence-numa-e5a3b6b81d4eff19.json",
  "interactiveUrl": "https://semiaifoundry.com/ai-atlas/#coherence-numa",
  "related": [],
  "supersedes": [],
  "supersededBy": [],
  "contentHash": "9f645460db7cff4ee9a77c002d7c5513a554dbda8c96a47040b6d8fb1995c2e2",
  "contentLength": 4889,
  "jsonUrl": "https://semiaifoundry.com/agents/publications/atlas-lesson-coherence-numa.json",
  "markdownUrl": "https://semiaifoundry.com/agents/publications/atlas-lesson-coherence-numa.md",
  "sections": [
    {
      "id": "section-1",
      "title": "Cache coherence and NUMA placement",
      "start": 41,
      "end": 398
    },
    {
      "id": "section-2",
      "title": "The mechanism",
      "start": 398,
      "end": 1613
    },
    {
      "id": "section-3",
      "title": "Science and assumptions",
      "start": 1613,
      "end": 1641
    },
    {
      "id": "section-4",
      "title": "Average access path",
      "start": 1641,
      "end": 2270
    },
    {
      "id": "section-5",
      "title": "Engineering example",
      "start": 2270,
      "end": 2476
    },
    {
      "id": "section-6",
      "title": "Distinctions and tradeoffs",
      "start": 2476,
      "end": 2941
    },
    {
      "id": "section-7",
      "title": "Specifications and interfaces",
      "start": 2941,
      "end": 3183
    },
    {
      "id": "section-8",
      "title": "Interfaces",
      "start": 3183,
      "end": 3349
    },
    {
      "id": "section-9",
      "title": "Check your understanding",
      "start": 3349,
      "end": 3378
    },
    {
      "id": "section-10",
      "title": "Two cores update different counters in the same cache line. Why might they interfere?",
      "start": 3378,
      "end": 3794
    },
    {
      "id": "section-11",
      "title": "Evidence and scope",
      "start": 3794,
      "end": 4114
    },
    {
      "id": "section-12",
      "title": "Sources",
      "start": 4114,
      "end": 4422
    },
    {
      "id": "section-13",
      "title": "Continue exploring",
      "start": 4422,
      "end": 4445
    },
    {
      "id": "section-14",
      "title": "Foundations",
      "start": 4445,
      "end": 4598
    },
    {
      "id": "section-15",
      "title": "Related lessons",
      "start": 4598,
      "end": 4889
    }
  ],
  "citations": [
    {
      "title": "Explore in Atlas",
      "url": "https://semiaifoundry.com/ai-atlas/#coherence-numa"
    },
    {
      "title": "What is NUMA? Linux kernel 6.6 documentation",
      "url": "https://www.kernel.org/doc/html/v6.6/mm/numa.html"
    },
    {
      "title": "Published lesson data",
      "url": "https://semiaifoundry.com/ai-atlas/lesson-data/coherence-numa-e5a3b6b81d4eff19.json"
    },
    {
      "title": "Atlas releases and licensing",
      "url": "https://semiaifoundry.com/ai-atlas/licenses.html"
    },
    {
      "title": "Host CPU",
      "url": "https://semiaifoundry.com/learn/atlas/host-cpu/"
    },
    {
      "title": "Shared L2 cache",
      "url": "https://semiaifoundry.com/learn/atlas/l2-cache/"
    },
    {
      "title": "Out-of-order CPU pipeline",
      "url": "https://semiaifoundry.com/learn/atlas/cpu-out-of-order/"
    },
    {
      "title": "DDR5 server memory",
      "url": "https://semiaifoundry.com/learn/atlas/ddr-memory/"
    },
    {
      "title": "Full memory hierarchy and input path",
      "url": "https://semiaifoundry.com/learn/atlas/memory-hierarchy-route/"
    }
  ],
  "recordHash": "e5aaa0f3d7794afa69e9746c00770d50907b7d0f4a062172428076e7c680f5be",
  "contentFormat": "text/markdown",
  "content": "Processing architectures · Atlas v1.3.0\n\n# Cache coherence and NUMA placement\n\nKeeps shared cache lines consistent while preserving awareness of physical memory location.\n\n[Explore in Atlas](https://semiaifoundry.com/ai-atlas/#coherence-numa)Core to multi-socket server; diagrams are logical\n\nLearning objectiveSeparate consistency, synchronization and physical locality in shared-memory systems.\n\n## The mechanism\n\nMultiple CPU cores can cache copies of the same memory line. A coherence protocol tracks copies and coordinates ownership when a core writes. Coherence provides an agreement about values; it does not make every access equally close or eliminate software synchronization. In a NUMA system, memory controllers belong to different locality domains, so an address may be directly attached to one CPU and reached over a link from another. Thread placement and allocation policy determine which path dominates. The Linux kernel documents this distinction and exposes memory policy controls for local, bound and interleaved allocation.\n\n1.  Map an address to its physical NUMA node and identify where the requesting thread is running.\n2.  Look for a valid local cache copy before issuing a request toward a memory controller or another cache.\n3.  On a write, obtain the protocol’s required ownership and invalidate or update conflicting cached copies.\n4.  Place frequently used pages near their workers, or deliberately spread pages when aggregate bandwidth matters more.\n5.  Measure remote accesses and cache-line transfers; change allocation and worker affinity together when diagnosing a bottleneck.\n\n## Science and assumptions\n\n### Average access path\n\n$$\nL_{\\mathrm{avg}}=pL_{\\mathrm{local}}+(1-p)L_{\\mathrm{remote}}\n$$\n\nMean latency is the local-access fraction times local latency plus the remaining fraction times remote latency.\n\nSymbols and units\n\nL\\_avg\n\nMean access latency in the two-path model\n\nns\n\np\n\nLocal-path access fraction\n\nfraction\n\nL\\_local\n\nLocal-path latency\n\nns\n\nL\\_remote\n\nRemote-path latency\n\nns\n\np is the fraction of accesses using the local path; L values are latency in ns. The average is a first diagnostic, not a tail-latency estimate.\n\nAssumptions Two paths and independent requests; excludes cache hits, overlap and queueing.\n\n## Engineering example\n\nSynthetic two-path example: 75% of requests at 80 ns and 25% at 160 ns gives a 100 ns average. Moving pages changes the fractions; simply adding cores does not shorten either path.\n\n## Distinctions and tradeoffs\n\nCache coherence is neither a guarantee of low latency nor a substitute for locks, atomics or a language memory model.\n\nInterleaving pages can balance memory bandwidth, while placing pages locally can reduce latency; the best choice depends on access sharing and thread migration.\n\nInput pipelines and CPU-managed inference caches can stall accelerators when pages repeatedly cross sockets or writable metadata bounces between cores.\n\n## Specifications and interfaces\n\nCoherence granularity\n\nCache line\n\nIndependent variables can still share one coherence unit.\n\nNUMA latency\n\nLocal and remote paths\n\nNanoseconds depend on machine topology and contention; no universal ratio.\n\n### Interfaces\n\nCore load/store Input\n\nAddress, ownership request and ordering requirements\n\nInter-socket fabric Output\n\nRemote data or coherence ownership messages\n\n## Check your understanding\n\n### Two cores update different counters in the same cache line. Why might they interfere?\n\n1.  The line’s ownership may move between cores\n2.  Different variables can never interfere\n3.  NUMA forces all writes to disk\n\nAnswer and reasoning\n\nThe line’s ownership may move between cores\n\nFalse sharing occurs because ownership is managed at cache-line granularity even though the variables are logically independent.\n\n## Evidence and scope\n\nTopology illustrations omit protocol state details. Local-versus-remote numbers are invented for calculation, not measurements of a named CPU.\n\nUse the execution investigation for the shared tensor-to-memory-to-result thread; no current standalone calculator models this lesson’s full mechanism.\n\n## Sources\n\n-   [What is NUMA? Linux kernel 6.6 documentation](https://www.kernel.org/doc/html/v6.6/mm/numa.html)\n\n[Published lesson data](https://semiaifoundry.com/ai-atlas/lesson-data/coherence-numa-e5a3b6b81d4eff19.json) · [Atlas releases and licensing](https://semiaifoundry.com/ai-atlas/licenses.html)\n\n## Continue exploring\n\n### Foundations\n\n-   [Host CPU](https://semiaifoundry.com/learn/atlas/host-cpu/)\n-   [Shared L2 cache](https://semiaifoundry.com/learn/atlas/l2-cache/)\n\n### Related lessons\n\n-   [Out-of-order CPU pipeline](https://semiaifoundry.com/learn/atlas/cpu-out-of-order/)\n-   [DDR5 server memory](https://semiaifoundry.com/learn/atlas/ddr-memory/)\n-   [Full memory hierarchy and input path](https://semiaifoundry.com/learn/atlas/memory-hierarchy-route/)"
}
