Both processes can then map regions of that section object to their respective virtual address spaces. After both processes have done so, each process will have a region of virtual memory pages mapped to the shared region of physical memory pages.
Note that the section object might be based on a file on disk, in which case you have a memory-mapped file shared across processes: this is what the OS image loader does with DLLs. Or, the section object may not be based on a file on disk, in which case it is purely a shared memory region backed by the page file, if present. Neither your application nor the CPU has to care whether the memory pages are shared with another process or not.
Thanks for visiting DZone today,. Edit Profile. Sign Out View Profile. Over 2 million developers have joined DZone. How shared memory and memory-mapped files function on Windows operating systems.
Like 2. Download Microsoft Edge More info. Contents Exit focus mode. Is this page helpful? Please rate your experience Yes No. Any additional feedback? Submit and view feedback for This product This page. View all page feedback. In this article. To obtain a MemoryMappedFile object that represents a persisted memory-mapped file from a file on disk.
CreateFromFile method. To obtain a MemoryMappedFile object that represents a non-persisted memory-mapped file not associated with a file on disk. CreateNew method. CreateOrOpen method.
To obtain a MemoryMappedFile object of an existing memory-mapped file either persisted or non-persisted. OpenExisting method. To obtain a UnmanagedMemoryStream object for a sequentially accessed view to the memory-mapped file. CreateViewStream method. To obtain a UnmanagedMemoryAccessor object for a random access view to a memory-mapped file. CreateViewAccessor method. SafeMemoryMappedFileHandle property. SafeMemoryMappedViewHandle property.
Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services.
Privacy policy. To share data, multiple processes can use memory-mapped files that the system paging file stores. Then the process uses the file mapping object handle that CreateFileMapping returns in a call to MapViewOfFile to create a view of the file in the process address space.
The process then uses the CopyMemory function to write a string to the view that can be accessed by other processes. This requires that the first process must have the SeCreateGlobalPrivilege privilege.
0コメント