![]() This sample application is useful for exploring the behavior of memory-mapped files in a process, and it provides several useful implementation examples. In addition to this technical article, a sample application called ProcessWalker is included on the Microsoft Developer Network CD. Introduction to managing memory in Windows™ operating systems The following topics are discussed in this article: In an effort to simplify these decisions, this technical article focuses on the use of the memory-mapped file functions in Win32: the functions that are available, the way they are used, and the impact their use has on operating system resources. The file cannot reside on a remote computer if you want to share memory between multiple processes.Microsoft Developer Network Technology Groupĭetermining which function or set of functions to use for managing memory in your Win32™ application is difficult without a solid understanding of how each group of functions works and the overall impact they each have on the Microsoft® Windows NT™ operating system. That is, the views contain identical copies of the file on disk. When multiple processes use the same file mapping object to create views for a local file, the data is coherent. When the process needs data from a portion of the file other than what is in the current file view, it can unmap the current file view, then create a new file view. The file views created by each process reside in the virtual address space of that process. A process can create multiple views for a file mapping object. A process manipulates the file through the file views. When the pages of the file mapping object are swapped back in, they are restored from the file.Ī file view can consist of all or only part of the file mapping object. This means that when the system swaps out pages of the file mapping object, any changes made to the file mapping object are written to the file. The file mapping object can consist of all or only part of the file. The file on disk can be any file that you want to map into memory, or it can be the system page file. The following illustration shows the relationship between the file on disk, a file mapping object, and a file view. Processes can also manipulate the file view with the VirtualProtect function. The use of file mapping improves efficiency because the file resides on disk, but the file view resides in memory. Processes read from and write to the file view using pointers, just as they would with dynamically allocated memory. Multiple processes can also use memory-mapped files to share data. It also allows the process to work efficiently with a large data file, such as a database, without having to map the whole file into memory. ![]() File mapping allows the process to use both random input and output (I/O) and sequential I/O. A file view is the portion of virtual address space that a process uses to access the file's contents. The system creates a file mapping object (also known as a section object) to maintain this association. File mapping is the association of a file's contents with a portion of the virtual address space of a process.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |