Two cores with their own caches and one shared memory. This lesson asks which core sees a write first, and what happens when two cores disagree about the order.
Before you start. A thread is one line of work in a program, and a core is one processor of the chip, running one thread at a time (One key, many hands). Each core keeps its own small copy of recent memory, called a cache, so one core can hold an older value than another (The Memory Hierarchy (cache, locality, the memory wall)). A lock lets one thread at a time into a stretch of code, and an atomic add updates one number in a single step nobody can interrupt (One key, many hands). The earlier lesson was about how fast these are. This one is about what a thread sees when there is no lock at all.
Lesson 41 of 41 in How Computers Work
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.