1
votes

So I really don't get this. Can anyone explain how to do these problems?

Suppose we have a 32-bit CPU with a paging-based memory system. The size of a page is 4KB(2^12). Now the CPU generates a virtual addres 0x0000AAA

1.) What is the virtual page number of this virtual address? What is the page offset?

2.) Using the page table below, translte the above virtual address into physical address - in hex representation. The page table shows the first 5 entries.

0 - 0xAAAAA 1 - 0xBBBBB 2 - 0xCCCCC 3 - 0xDDDDD 4 - 0xEEEEE

2
Is this homework? What have you tried?Sam Mussmann
It is not homework it is exam review. I know the answer I just don't really understand itJohsh Hanks

2 Answers

2
votes

If the size of a page is 4KB (= 4096 bytes), that means all addresses from 0 up to, and including 4095 (0x00000fff) are in the first page.

0x0000aaa is less than 0x00000fff, so this is still in the first page (page #0).

To obtain the physical address corresponding with virtual address 0x00000aaa, lookup the prefix for page #0, which is 0xAAAAA.

1
votes

Since it is given that page size is 4 KB, it means a page has 4K addresses. Hence we need 12 bits to reach every address in a page.
Hence, page offset = 12 bits .
Since, the system is 32 bit, hence 20 bits will be used as page number.
Since page size is equal to frame size, therefore the frame offset = 12 bits.
Now, use the page table to use get the physical address.