mmap

In computing, mmap(2) is a POSIX-compliant Unix system call that maps files or devices into memory.

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.

Protection information—for example, marking mapped regions as executable—can be managed using mprotect(2), and special treatment can be enforced using madvise(2).

mmap and associated systems calls were designed as part of the Berkeley Software Distribution (BSD) version of Unix.

sample output: The mmap system call has been used in various database implementations as an alternative for implementing a buffer pool, although this created a different set of problems that could realistically only be fixed using a buffer pool.