Paging & Address Translation

a page

Think of a long scroll of text that you want to make easier to handle. You cut it into equal-length sheets and number them: sheet 0, sheet 1, sheet 2. A PAGE is exactly that — one fixed-size slice of a program's logical (virtual) address space. The whole address space the program thinks it has is just an ordered run of these equal slices, numbered from 0 upward.

More precisely, a page is a contiguous, fixed-size block of LOGICAL addresses — typically 4 KB on most systems, though larger 'huge pages' (2 MB, 1 GB) also exist. The address space is divided into pages of this size, numbered 0, 1, 2, and so on. The key trait is that a page is a unit of LOGICAL memory as the program sees it; its twin in physical memory is the FRAME, which is the same size. Paging works precisely because pages and frames are equal in size, so any page fits into any frame with no leftover gap at the frame level. A logical address is interpreted as a (page number, offset) pair: the page number says which slice, the offset says how far into that slice.

Pages matter because they are the granularity at which memory is mapped, protected, shared, and (in virtual-memory systems) moved to and from disk. The page is not a property of the data inside it — a page does not 'know' it holds code or a number; it is simply a fixed window of addresses. A common confusion is to mix up a page (logical, what the program sees) with a frame (physical, where it actually lives); they are the same size on purpose, but a page is an address-space slice while a frame is a real memory slot.

With a 4 KB (2^12-byte) page size, logical addresses 0 through 4095 are page 0, addresses 4096 through 8191 are page 1, and so on. Address 5000 lies in page 1 (5000 divided by 4096 = 1) at offset 904 (5000 minus 4096).

Equal 4 KB slices numbered from 0; any logical address belongs to exactly one page at a known offset.

A page is LOGICAL (what the program sees) and a frame is PHYSICAL (where it lives) — same size, different worlds. Do not assume page numbers and frame numbers match; that is exactly what the page table maps between.

Also called
logical pagevirtual page邏輯頁虛擬頁