tags:

views:

107

answers:

1

If i have memory mapped a file of size 10GB in a 1GB machine and if i trigger a file i/o, after making sure that the data requested is not in physical memory, will the fetched data get mapped to the corresponding virtual address in mmap?

When i access the same location using mmap, will it again do an i/o (or will it make use of the data that was fetched using file i/o)

Thanks in advance,

Gokul.

A: 

It depends on the platform, but in general it'll be treated like other memory (swapped out when not in use, swapped in when required), except that instead of using the normal swap files/partitions it swaps from the original file on disk.

Douglas Leeder
Say i read a portion of the file using file i/o, can i assign that memory into one range of address in mmap?
Gokul
No, you don't use file i/o - you mmap the file, and then access it as if it were memory.
Douglas Leeder
OK. Thanks. I was actually intending to combine async i/o with mmap, but seems like it is not possible.
Gokul