title: Time Consumption of FlushViewOfFile (Windows) and msync(Linux)
body: <p>We are interested in the time consumption of <a href="https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-flushviewoffile" rel="nofollow noreferrer"><code>FlushViewOfFile</code></a> and <code>msync</code>. Quoting the <a href="https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-unmapviewoffile" rel="nofollow noreferrer"><code>UnmapViewOfFile</code></a> documentation:</p>
  <blockquote>
  <p>To minimize the risk of data loss in the event of a power failure or a system crash, applications should explicitly flush modified pages using the <code>FlushViewOfFile</code> function.</p>
  </blockquote>
  <p>Are <code>FlushViewOfFile()</code> and <code>msync()</code> expensive operations? The reason we are asking is that in our application, we may not need to minimize the risk of data loss in the event of a system crash.</p>
  <p>Thank you,</p>