Videos: Virtual Memory
slides: virtual-memory.pdf |
Virtual memory allows a process-specific view of memory, using physical memory as a cache for disk, enforcing write and execution constraints, and efficiently forking processes.
- How virtual memory allows a parent and child process to have different views of the same addresses—
by having a configurable mapping from virtual addresses to physical addresses. - The organization of (virtual) memory that a Linux process uses.
- Virtual memory allows a process to use more virtual memory than is available in phsyical form. In that mode, physical memory acts as a kind of cache for data stored on disk.
- How a virtual memory table supports the translation of a virtual address to a phsyical address.
- A view of address translation at the level of CPU, memory, and disk interactions, and how a TLB acts as a specialized cache for translation.
- A virtual-memory system can also check write and execute permissions to help detect and prevent errors.
- An example program that demonstrates write and execute permissions for different kinds of memory, especially as specified in an ELF executable.
- The mmap syscall allows a program to manipulate the virtual-memory mapping.
- The munmap system call removes page mappings previously created with map.
- The mprotect system supports modifying the execute and write permissions of a mapped page. Permission violations can be handled through the SIGSEGV signal—
for example by changing page permissions via mprotect. - How virtual memory enables in-memory sharing of position-independent code for a shared library.
- The fork syscall efficiently implements as process “copy” by sharing pages and copying shared pages when they’re written to. A program can enable sharing between a parent process and a child by creating a page with the MAP_SHARED option.