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

Sign in to watch this lesson
Performance of Concurrent Code · 3:54
Why threads that never touch the same variable can still fight over memory: caches move whole lines, so per-thread slots that sit side by side, like parallel_accumulate's results vector, bounce one cache line between cores. We measure adjacent versus padded slots on an Apple M3, test 32, 64 and 128-byte spacing honestly, find that Apple clang 15 lacks std::hardware_destructive_interference_size, and settle on alignas(128), with the book's advice on padding a mutex away from its data.