Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The mmap() system call creates a new memory mapping in the calling process’s virtual address space. A mapping can be of two types:
File mapping: A file mapping maps a region of a file directly into the calling process’s virtual memory. Once a file is mapped, its contents can be accessed by operations on the bytes in the corresponding memory region. The pages of the mapping are (automatically) loaded from the file as required. This type of mapping is also known as a file-based mapping or memory-mapped file.
Anonymous mapping: An anonymous mapping doesn’t have a corresponding file. Instead, the pages of the mapping are initialized to 0.
Note:
Another way of thinking of an anonymous mapping (and one that is close to the truth) is that it is a mapping of a virtual file whose contents are always initialized with zeros.