Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a memory mapping api on windows platform, just like mmap() on linux?

Tags:

memory

mmap

Is there an api to do memory mapping, just like

mmap() 

on linux?

like image 284
Fernandez Avatar asked Nov 03 '10 13:11

Fernandez


People also ask

Does mmap work on Windows?

Windows doesn't have mmap , but it does have MapViewOfFile . Both of these implement memory mapped files, but there's one important difference: Windows keeps a lock on the file, not allowing it to be deleted. Even with the Windows flag FILE_SHARE_DELETE deletion does not work.

What is memory mapping in Linux?

Memory mapping is one of the most interesting features of a Unix system. From a driver's point of view, the memory-mapping facility allows direct memory access to a user space device. To assign a mmap() operation to a driver, the mmap field of the device driver's struct file_operations must be implemented.

What is memory mapping in Windows?

A memory-mapped file contains the contents of a file in virtual memory. This mapping between a file and memory space enables an application, including multiple processes, to modify the file by reading and writing directly to the memory.

What is memory mapping in operating system?

What Is Memory-Mapping? Memory-mapping is a mechanism that maps a portion of a file, or an entire file, on disk to a range of addresses within an application's address space. The application can then access files on disk in the same way it accesses dynamic memory.


1 Answers

Depends on what exactly you want to use it for. If you want to map existing files into memory, that's supported with memory-mapped files. They can also be used to share memory between processes (use named mapping object with no underlying file). If you want to map physical memory, that's generally not supported from user mode, although there are some tricks.

like image 191
Igor Skochinsky Avatar answered Nov 23 '22 06:11

Igor Skochinsky