Coordination: waiting and handing over
hard 50 minCoordination makes one thread go on only after another has done something.
Watch lesson4:20
Where it shows up
The same pattern appears across everyday software.
Java CountDownLatch
The reference shows two latches: a start signal that holds all workers back, and a done signal that the driver waits for. It states that the count cannot be reset.
Java CyclicBarrier
Uses an all-or-none breakage model: if one thread leaves early because of an interrupt, a failure or a timeout, all others at the barrier get an exception. `await` returns the arrival index.
Java Phaser
A reusable barrier whose number of parties can change while it is used. Parties register and leave, and every phase has a number.
Java SynchronousQueue
A queue without any capacity: each insert waits for a remove by another thread. The purest handoff.
Go sync.WaitGroup
Add, Done and Wait. Since Go 1.25 the method Go counts and starts together, and the vet tool reports Add calls in the wrong place.
Linux futex
The system call compares a memory word with an expected value and blocks, atomically. If the value changed meanwhile it does not sleep: look and sleep in one step.
Python asyncio.TaskGroup
The first task that fails cancels the remaining ones, and the block ends only when all of them have ended.
C++ std::latch and std::condition_variable
The latch is a single-use barrier that cannot be increased. The condition variable takes a predicate, which is the loop against spurious wake-ups.
PostgreSQL LISTEN and NOTIFY
Notifications are delivered only when the sending transaction commits: state first, then the signal. Equal notifications in one transaction may be folded into one, so listeners must read the table.
Kubernetes init containers
They run to completion before the app containers of a pod start. A start latch for processes instead of threads.