Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 31s8 days 9 hours 54 minutes 31 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 31s8 days 9 hours 54 minutes 31 seconds.

Sign in to watch this lesson
Concurrent Data Structures · 4:07
The Treiber stack, built from one compare-exchange on the head pointer. We watch two pushes race for the same head and see a failed exchange refresh the new node's next pointer, add pop with a null check and shared_ptr data, and use ThreadSanitizer and AddressSanitizer to show why a node must be complete before it is published and why pop can't delete what it removed, so the first version leaks. Then we race it against a mutex stack on an Apple M3: faster with one thread, about three times slower with eight.