Subj : Re: Memory synchronization with pthreads To : comp.programming.threads From : Joseph Seigh Date : Sun Jan 16 2005 03:54 pm On Sun, 16 Jan 2005 19:51:38 +0000, Chris Vine wrote: > Section 4.10 of IEEE Std 1003.1-2001 provides that a number of specified > functions, such as pthread_mutex_lock(), pthread_mutex_trylock(), > pthread_mutex_unlock(), sem_post() and sem_wait() "synchronize memory with > respect to other threads". > > For a process with multiple threads does this imply that a call in a thread > which, say, locks or unlocks a mutex will synchronise memory with respect > to only the other threads in the process holding (or trying to hold) a lock > on the mutex, or does it require all threads in the process to have memory > synchronized, whether or not they are waiting on the mutex and indeed > whether or not they have access to the mutex? > Only with respect to other threads using the same mutex or semaphore as far as you will be able to reliably and deterministically observe. Most memory models require memory to be synchronized on both reading as well as writing memory. So the impression you have that one thread can synchronize memory for all other threads without the need for any action by those threads isn't the case for most platforms. -- Joe Seigh .