mmap
Sign in to saveIn computing, mmap(2) is a POSIX-compliant Unix system call that maps files or devices into memory. It is a method of memory-mapped file I/O. It implements demand paging because file contents are not immediately read from disk and initially use no physical RAM at all. The actual reads from disk are performed after a specific location is accessed, in a lazy manner. After the mapping is no longer needed, the pointers must be unmapped with munmap(2). Protection information—for example, marking mapped regions as executable—can be managed using mprotect(2), and special treatment can be enforced usi
In the Vinony graph
Vinony's link graph records 66 inbound references to mmap, and connects out to Berkeley Software Distribution, inter-process communication and shared memory.
It sits within the topics C POSIX library and Inter-process communication.
Vinony links it to 10 Wikipedia language editions.
Wikidata facts
- Instance of
- system call
- Subclass of
- memory-mapped file
Show 2 more facts
- Stack Exchange tag
- stackoverflow.com/tags/mmap
- operating system
- Unix-like operating system
Sources (1)
via Wikidata · CC0
~6 min read
Encyclopedic overview
8 sectionsContents
- History
- File-backed and anonymous
- Memory visibility
- Example of usage under the C programming language
- Usage in database implementations
- See also
- References
- Further reading
In computing, mmap(2) is a POSIX-compliant Unix system call that maps files or devices into memory. It is a method of memory-mapped file I/O. It implements demand paging because file contents are not immediately read from disk and initially use no physical RAM at all. The actual reads from disk are performed after a specific location is accessed, in a lazy manner. After the mapping is no longer needed, the pointers must be unmapped with munmap(2). Protection information—for example, marking mapped regions as executable—can be managed using mprotect(2), and special treatment can be enforced using madvise(2).
In Linux, macOS and the BSDs, mmap can create several types of mappings. Other operating systems may only support a subset of these; for example, shared mappings may not be practical in an operating system without a global VFS or I/O cache.
Excerpted from Wikipedia’s “mmap” article, available under the CC BY-SA 4.0 licence.