Question 24 Consider a system that uses two level paging tables

Question 24
Consider a system that uses two level paging tables with 16 full pages of lower level page table,
each page of lower level page table contains 64 8 byte paging table entries. Physical memory
contains 32 page frames. Explain how you found each answer for 2 and 3.
1. Why does each address refer to 1 byte?
2. How large is each page of memory?
3. How large (in bytes) is physical memory? Virtual memory?
4. Using a diagram illustrating the paging tables to help you, explain step by step how you
would convert the following virtual address to a physical address. Be sure to explain how a
page of your paging table is accessed, the contents of at least one sample entry for each level
of page table, and how + why the address bits are divided into groups.
101 10101010 10000111
Each address refers to 1 byte. If we assume an address referred to a larger unit, like a 4 or
8 byte word then we would not be able to access single bytes (because they would not have
their own addresses. So (Most languages have an option to access single bytes so they must
be addressable.)
The size of each page of memory would be 8*64=29 bytes or 0.5KB
In virtual memory we have 16 pages of page table entries each of which refers to 64 pages
of 0.5KB. So there are 16 * 64 * 0.5 = 512KB
In physical memory we have 32 page frames, each page frame contains 29 bytes so the size
of physical memory is 214 bytes or 16KB
The virtual memory is addressed using an address containing 19 bits; therefore, the
number of virtual addresses in the virtual memory (the size of virtual memory) is 219
4 bits are needed to index the addresses in the upper level page table (24=16). 6 bits are
needed to index the page table entries in each page (26=64). 9 bits are needed to index
within each page (8*64=29).
So the address given can be divided, 4 bits to find the entry in the top level page table, 6
bits to find the entry in the second level page table, and 9 bits to find the offset on the page
\
PT1 field
PT2 field
offset
offset
5
2
4
3
CONVERSION OF ADDRESS
Go to the start of the page frame that contains the top level page table.
Consider the first 4 bits of the address being translated. Use the first 4 bits as an offset into
the top level page table. The entry at this offset ( the 1010 th entry of the top level page table)
includes a pointer. That pointer holds the address of the start of the page containing the
desired page table entry
3. Go to the address pointed to by the entry in the top level page table. This is the beginning of
a page full of page table entries. The page we are looking for is described by one of the page
table entries on this page.
4. Use the second 6 bits of the address being translated as an offset into the page containing the
desired page of the page table (we want the 101010 th page table entry in this page of the
page table). This will bring you the correct page table entry for the page of memory
containing the address we wish to translate.
5. Examine the contents of the selected page table entry. The “in physical memory” flag will
tell us if the page of virtual memory described by the page table entry is in a page frame of
physical memory
a. If the desired page is not in memory (the value of the flag is 0) a page fault will be
generated. Remember, a page fault in generated when we try to access a page of
virtual memory that is not presently in a page frame in physical memory. The page
fault will cause the desired page to be loaded into physical memory. Once the desired
page of the page table is loaded into physical memory we update the page table entry
for the page (“in physical memory flag” becomes 1 and the page frame number of the
1.
2.
page frame the page of virtual memory was loaded into is placed into the page frame
entry in the page table.
6. Extract the page frame number from the page table entry for the desired page of memory
(the one containing the address being translated)
7. Append the offset of the address being translated (the rightmost 9 bits) to the end of the page
frame number to give the physical address. Note that the number of bits in the page frame
number will be 5 (because there are 32 page frames)