Two cores reaching for one shared counter, with a lock, an atomic add and a private copy as the ways to stop them clobbering each other. This lesson asks what those fixes cost once many threads, not two, are in the queue.
Before you start. A thread is one line of work inside a program, and a core is one of the chip’s processors, able to run one thread at a time. A lock lets one thread at a time touch a shared value, and every other thread that wants it has to wait (Concurrency & the Hardware). The scheduler, the part of the kernel that hands out turns on the cores, sets a waiting thread aside until it is woken (Waiting without spinning). Correct is the easy half. This lesson is about fast.
Lesson 40 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.