 | | The Pthreads standard requires library implementors to synchronize memory writes (with respect to reads and other writes) for a subset of Pthreads and POSIX.1 functions. For example, if a thread calls pthread_mutex_lock, the function not only protects access to the shared data but also ensures that prior modifications to that data are committed to memory at the point of the call. The way in which this is done is implementation-specific, but typically involves some memory-barrier machine instruction that synchronizes cache and memory contents across the CPUs in a multiprocessing system. The end result is that any thread's view of memory is the same as that of any other thread in the same process, regardless of which CPUs the threads are running on. | |
|