OS Memory Mapped Files

As many computer programmers feel that accessing the files is cumbersome and inconvenient mainly when compared to accessing ordinary memory.

Therefore, for all above reason, some OSs have provided a way to map the files into the address space of a running process.

Conceptually, we can imagine the existence of the following two new system calls:

  • map
  • unmap

From the above two new imagined system calls, the map gives a file name and a virtual address that causes the OS to map the file into the address space at the virtual address.

For those type of computer system that supports segmentation, file mapping works best there.

File mapping introduces the following three problems:

  • It is too hard for any computer system to know the exact length of any output file
  • If a file is mapped in by one process and opened for conventional reading by another. If the first process modifies a page, then that change willn't be reflected in the file on the disk until the page is evicted
  • A file may be larger than a segment, or sometime larger than the whole virtual address space

Operating System Online Test

« Previous Tutorial Next Tutorial »

Like/Share Us on Facebook 😋