CS FundamentalsHardGATE CS

What is the main advantage of memory-mapped files (mmap) over read()/write() for random access to a large file?

  1. A. Pages are loaded on demand by the paging system and accessed with ordinary loads and stores, avoiding a system call and an extra copy per access
  2. B. The file is copied entirely into RAM at mmap() time
  3. C. Writes become atomic transactions
  4. D. The file no longer occupies any disk space

Correct answer: A. Pages are loaded on demand by the paging system and accessed with ordinary loads and stores, avoiding a system call and an extra copy per access

mmap maps file pages into the address space; page faults bring them in as touched, and data need not be copied through a user buffer. Durability still needs msync() or the OS's write-back.

More Operating Systems questions

Exams that ask this topic