← BYTES
Unix IPC·Starter·Ref: 15.1.71
At a basic level, why do multiple threads sharing the same memory need synchronization primitives at all?
Have a question about this video? Mention reference 15.1.71 when you contact us.
a.They don't -- shared memory is always automatically safe for any number of threads to access simultaneously
b.Synchronization is only needed if the threads are running on different physical machines
c.Without coordination, two threads reading and writing the same memory at unpredictable, interleaved times can produce incorrect results (race conditions) that wouldn't occur if each thread ran entirely on its own
d.Synchronization exists purely to make programs run slower, with no correctness benefit
Shared memory gives threads a fast way to communicate, but with no coordination at all, their accesses can interleave in unpredictable ways that produce genuinely incorrect results -- synchronization primitives exist specifically to constrain that interleaving to safe, predictable patterns.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES15171#UnixIPC