title: linux, read/write the same file from different process, the read process got some unexpected data
body: <p>The scenario:</p>
  
  <ol>
  <li>process(A) opens file with <code>r+</code> mode.</li>
  <li>process(B) opens the same file with <code>r+</code> mode.</li>
  <li>process(A) writes some data into it, and <code>fflush()</code>.</li>
  <li>process(A) notifies process(B) to read the data.</li>
  <li>process(B) reads the data. &lt;---- here is the problem.</li>
  </ol>
  
  <p><strong>Got some unexpected bytes( 0000 0000 ...) at the head part, and the left bytes are correct</strong>.    </p>
  
  <p>PS: The data size is about 16k, and I write/read it with one <code>fwrite()</code>/<code>fread()</code> call.</p>
  
  <p>I also did a test, that is, if process(B) calls <code>fflush()</code> before reading the data, the result is correct.</p>
  
  <p>My question is, </p>
  
  <ol>
  <li>What is the correct way to make sure process(B) always be able to
  get the updated data?<br></li>
  <li>As process(A) has called <code>fflush()</code> already, why process(B) also needs
  to fflush() before reading the data?<br></li>
  </ol>