How often does processor cache flush?
c, multithreading, pthreads, thread-safety
Solution
Memory is synchronized as soon as you call a synchronization primitive/memory barrier such as `pthread_mutex_lock`. Aside from that, you should not assume any synchronization unless you're using C11 atomic types.
Problem
Say I have a casual single-byte variable. I think on pretty much all systems single-byte operations are atomic, but if not please let me know. Now, say one thread updates this variable. How long should I expect/prepare for this update to appear in the other threads? I know I can put the update around mutexes/locks/barriers to make sure it's synchronized everywhere, but I'm curious about this. The wait time probably varies depending on whether the other threads are on separate processors/cores, and maybe depending on processor type. Am I being logical for wondering this or have I greatly misunderstood something?