Gokul
Gokul

Reputation: 933

Memory mapping and file I/O

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.

Upvotes: 2

Views: 1690

Answers (1)

Douglas Leeder
Douglas Leeder

Reputation: 53310

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.

Upvotes: 1

Related Questions