Explore

Virtual Memory: How Paging Lets a Program Pretend It Owns All of Memory

by Froga

How an operating system translates the addresses a program uses into real physical memory, and why pages, page tables and a small hardware cache called the TLB are what make running many programs at once possible. Written for anyone comfortable with basic computer science who wants to know what actually happens underneath a page fault.

You're previewing this room. Log in or create a free account to answer the questions and track your progress.
Study material

A process never touches physical memory directly. Every address it uses is a virtual address, translated into a physical address through a page table the operating system maintains for it. Memory is divided into fixed-size chunks: pages on the virtual side, frames on the physical side, and the page table records which frame currently holds each page. A small hardware cache called the TLB (translation lookaside buffer) stores recently used translations so that most memory accesses can skip a full page table lookup. When a page a process needs is not currently loaded into any frame at all, the hardware raises a page fault, and the operating system loads the page from disk before the instruction can continue.

A process accesses a virtual address. The translation for it is not in the TLB, but the page table has a valid entry for that address pointing to a frame that already holds the page in RAM. What happens next?

multiple choice

AThe access fails with a page fault, because a TLB miss always means the page itself is not currently resident
BThe CPU walks the page table, finds the frame the page is already in, completes the access, and stores the new translation in the TLB
CThe operating system terminates the process, because the TLB and the page table disagree with each other
DThe access succeeds, but only after the operating system doubles the number of entries in the page table
A TLB miss means the fast cache didn't have the answer cached, not that the page is missing from memory.
Log in to answer

Ready to test yourself?

Sign up free to answer, score points, and build your streak.

Virtual Memory: How Paging Lets a Program Pretend It Owns All of Memory · Froga