mmap
mmap is a POSIX system call that creates a new mapping in the virtual address space of the calling process. It can map a regular file or device into memory, or create an anonymous mapping that is not backed by any file. Mapped regions behave like arrays and can be accessed via pointers, with the actual I/O performed by the kernel as pages are faulted in or out.
Signature and parameters: void* mmap(void* addr, size_t length, int prot, int flags, int fd, off_t offset). The
Behavior: File-backed mappings can be shared between processes if MAP_SHARED; changes may be written back to
Notes: The offset must be a multiple of the page size, and the mapping length should be
Usage and portability: mmap is standard in POSIX; Windows provides a different API (MapViewOfFile). Performance benefits