CS FundamentalsHardGATE CS
What is the main advantage of memory-mapped files (mmap) over read()/write() for random access to a large file?
- 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
- B. The file is copied entirely into RAM at mmap() time
- C. Writes become atomic transactions
- 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
- Which statement about the page-fault rate versus the number of allocated frames is generally correct for a process with locality?
- The working-set model chooses a window Δ. What happens if Δ is too small and if it is too large?
- Page-fault-frequency (PFF) control sets an upper and a lower bound on each process's fault rate. If a process's rate exceeds the upper…
- Which of the following increase TLB reach without enlarging the TLB? 1. Using larger (huge) pages 2. Supporting multiple page sizes 3…
- On a context switch, why can a TLB WITHOUT address-space identifiers (ASIDs) not simply keep its entries?
- A hashed page table is used for 64-bit address spaces. Which statement about it is correct?