Index

Module 04 · How Computers WorkInside the operating system

Waiting without spinning

Concurrency and the Hardware
Concurrency and the Hardware · Open board

Two cores reaching for one shared counter, and a lock that lets only one of them touch it at a time. This lesson is about what comes after the lock: a thread that holds it, finds nothing it can do yet, and has to wait.

Before you start. When two threads touch the same memory at once, an update can be lost, and a lock fixes that by letting only one thread at a time near the shared value (Concurrency & the Hardware). The scheduler, the part of the kernel that hands out turns on the cores, can set a waiting thread aside and give its turns to others until something wakes it (Whose turn, and who decides).

Continue reading with a plan

The first three lessons of every track are free. This lesson is included with a plan, which unlocks every lesson, board, video, lab and paper for one price.

View plans →Already a member? Sign in

Lab

Ninety-five percent of the job splits across cores. How much faster can it possibly finish?

Leave The part that can be split up at 95%, drag Cores you throw at it upward, and watch What the next core buys.

Open The parallel ceiling →

Related paper

Review How Computers Work →

Saved in this browser, and to your account when you sign in.