c - Does inserting memory sync barrier after writing and before reading sharing variable also ensure the cache coherency -
if variable(not volatile) read/write accessed 2 threads without using locking , avoid locking , volatile using memory sync barriers before reading , after writing variable.
i read memory sync barrier serializes read/write operations mean write/read reflected in parallel other threads. cause processor cache invalidated thread can latest value instead of value in cache ?
the reason not using locks/volatile variable trying learn use memory sync barrier. may can me remove overhead of locks.
Comments
Post a Comment