Virtual Memory: 14 Summary
Virtual Memory Overview
Understanding Virtual Memory
- Virtual memory serves as a level of indirection between virtual program addresses and physical RAM addresses, enabling various functionalities.
- It allows mapping memory to disk, providing an almost unlimited memory capacity while ensuring programs cannot access each other's memory, enhancing security and reliability.
- Each program operates within its own 32-bit address space, which helps in efficiently filling holes in the physical address space without issues.
Performance Trade-offs
- The necessity of translating every virtual address to a physical address introduces performance challenges; there are approximately 1.33 memory accesses for every instruction executed.
- To manage translations effectively, page tables are utilized to track all translations for a program, leading to potentially large numbers of entries.
Page Size and Translation Efficiency
- Larger page sizes (e.g., 4 kilobytes) reduce the number of required page table entries, making translation more efficient on a 32-bit machine.
- A hardware component known as the Translation Lookaside Buffer (TLB), acts as a small cache for recently used page table entries to speed up translation processes.
Cache Mechanisms
- Two types of caches were discussed: physical caches that require prior translation before accessing data and virtual caches that use virtual addresses directly but lack protection against inter-program interference.