Let's examine in greater detail how virtual addresses are split up into
component pieces and translated. Suppose that a machine has 24 bits in its
virtual addresses, which implies that it's virtual address space is
224
words long, or 16,777,216 words. Further suppose that pages are 1K long.
Remember that 1K = 1024. This means there will be 16,777,216
÷ 1024 = 16384
pages in a program at maximum. Since 10 bits are required to count from 0
up to 1023, 10 bits out of the 24 would be the offset within the page and 14
bits of the 24 would be the page number. Fig. 12.6.1 shows this split of the
24 bits of a virtual address.
The offset within the page is the same as the offset within the frame, since pages and frames are the same size. The page number is what must be translated into a frame number, which can only be done by looking up the page number in the page table, finding what is there and inserting that into the upper part of the MAR. |