Recall & Review
beginner
What is a memory-mapped file?
A memory-mapped file is a file that is mapped into the memory address space of a process, allowing the file contents to be accessed like regular memory instead of using traditional file input/output operations.
Click to reveal answer
beginner
How does a memory-mapped file improve file access?
It allows programs to read and write files by directly accessing memory, which can be faster and more efficient than using read/write system calls because it reduces copying between user space and kernel space.
Click to reveal answer
intermediate
What happens when multiple processes map the same file into memory?
They can share the same physical memory pages, enabling efficient inter-process communication and data sharing without extra copying of data.
Click to reveal answer
intermediate
Name one risk or limitation of using memory-mapped files.
If the file is very large, mapping it entirely into memory can consume a lot of address space, and changes to the mapped memory might not be immediately saved to disk, risking data loss if the program crashes.
Click to reveal answer
intermediate
Explain the difference between memory-mapped files and traditional file I/O.
Traditional file I/O uses system calls to read or write data explicitly, copying data between disk and user memory. Memory-mapped files let the OS handle this by mapping file contents directly into memory, so programs can access files like arrays in memory.Click to reveal answer
What is the main benefit of using memory-mapped files?
✗ Incorrect
Memory-mapped files allow programs to access file data directly in memory, speeding up file operations.
Which of the following is true about memory-mapped files?
✗ Incorrect
Memory-mapped files map the file contents directly into the process's memory space.
What can happen if a program modifies a memory-mapped file's memory region?
✗ Incorrect
Changes to memory-mapped files may be buffered and written to disk later, not instantly.
Memory-mapped files are especially useful for:
✗ Incorrect
Memory-mapped files allow multiple processes to share the same memory region for efficient data sharing.
Which operating system feature supports memory-mapped files?
✗ Incorrect
Virtual memory management allows files to be mapped into a process's address space.
Describe what a memory-mapped file is and how it differs from traditional file reading and writing.
Think about how programs access file data in memory-mapped files versus normal file operations.
You got /4 concepts.
Explain one advantage and one limitation of using memory-mapped files.
Consider performance benefits and potential risks.
You got /2 concepts.