Memory map file

xiaoxiao2021-03-06  40

I have always been very clear about the concept of mapping. Today, I saw the Document section of Lao Luo's memory map, ready to resolve this blocking

1. Concept of memory mapping file: The memory map file provides a set of independent functions that enable the application to access the files on the disk by the memory pointer image. The files on the disk can be mapped to a location of the virtual address space of the process through the memory map file function. Once the mapping is completed, access to disk files can be as convenient as accessing the memory file.

2 Benefits using a memory mapped file: A system uses a memory mapping file to load and execute .exe and dll files. This can greatly save the time required to start running the page file space and the application. b You can use a memory map file to access the data file on the disk. This allows you to perform I / O operations on files and you can cache file content. c You can use a memory map file to make multiple processes running on the same computer to share data with each other. Note: Using memory mapping file data is implemented by data pages in 4K size.

3 Realization of memory mapping files: Let's first look at the Windows page virtual storage management, in Windows, every page is one of three situations at a moment: idle, hangs have already submitted of. When a page does not need, Windows can be turned out from memory, and when the page needs to be re-read from the physical memory into memory. The implementation principle of the memory map file is similar to this, and the memory mapping file also retains an area of ​​an address space and submits the physical memory to the area as needed. The difference is: When the memory map file accesss a disk file, the physical memory it submits is from the file ~!

Map file function in the second ASM

1 The memory mapped files include: CreatFileMapping, OpenFileMapping, MapViewOffile, UnmapViewOffile, and FlushViewOffile.

First come here, take a break :)

转载请注明原文地址:https://www.9cbs.com/read-51593.html

New Post(0)