How does mmap improve file reading speed?
<p>Assuming the address space can cover the file, it appears to me that mmap simply allocates a chunk of memory as large as the file about to be read, and creates a 1-to-1 relation between their corresponding blocks. However, why doing so speeds up file reading? It seems that in order to actually get the contents of the file, you still have to go to the disk, and read all the bytes on it. </p>

<p>What difference does it make, compared to malloc'ing the same size of memory and manually read the entire file into the malloc'ed area? </p>