title: Does msync() write to file only changed pages or wholly cached buffer?
body: <p>I use a POSIX-function <code>mmap()</code> in Linux. But when I do <code>msync()</code>, then does it write cached buffer to a file wholly, or somehow it is noted somewhere which pages have changed, and which did not, and writes to the file only changed - i.e. does <code>msync()</code> write to file only changed pages or cached buffer wholly?</p>
  
  <p>Suppose if we work with file of 1 GB by using <code>mmap()</code>, read it all, ie through a lot of page-fault raised in memory of the entire file. Then we changed only one byte, and called <code>msync()</code>, then it will begin to record the whole 1GB to a file or somehow determine the page you want changed and will only keep it, and <strong>how it is defined - how does it do this?</strong>?</p>