Memory Mapped Files: Difference between revisions
pc>Yuron No edit summary |
W81054ch [PHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPmludGVyZmFjZS1hZG1pbjxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs) m (1 revision imported) |
(No difference)
|
Latest revision as of 10:03, 5 August 2019
Depends on | File Access • Memory |
---|
A method of file access, memory mapping a file (or device) is a way of making the file appear in a process’ virtual address space. This is not necessarily as comprehensive as the more traditional file access methods – note that all the opened files need to fit in the process’ space and, sometimes, files are large (though with the advent of 64-bit address spaces on larger machines this will probably be less of a problem … at least for a few years). On the other hand it can be convenient to use and will typically be significantly faster than making sets of system calls.
Memory mapping a file on a virtual memory system does not mean the whole file is read into RAM! Usually a “lazy” approach will be used where only the appropriate pages will be fetched, on demand. This is basically the same demand paging mechanism used in virtual memory.
There is a worked example of this process in the download mmap
. This contains quite a few obscure calls; the important point is the text from the file appears in an ordinary array.
Also refer to: | Operating System Concepts, 10th Edition: Chapter 13.5, pages 555-560 |
---|