title: Shared memory - need for synchronization
body: <p>I've seen a project where communication between processes was made using shared memory (e.g. using <code>::CreateFileMapping</code> under Windows) and every time one of the processes wanted to notify that some data is available in shared memory, a synchronization mechanism using named events notified the interested party that the content of the shared memory changed.</p>
  
  <p>I am concerned on the fact that the appropriate memory fences are not present for the process that reads the new information to know that it has to invalidate it's copy of the data and read it from main memory once it is "published" by the producer process.</p>
  
  <p>Do you know how can this be accomplished on Windows using shared memory?</p>
  
  <p><strong>EDIT</strong>
  Just wanted to add that after creating the file mapping the processes uses MapViewOfFile() API only once and every new modification to the shared data uses the pointer obtained by the initial call to MapViewOfFile() to read the new data sent over the shared memory. Does correct synchronization require that every time data changes in shared memory the process that reads data must create MapViewOfFile() every time ?</p>