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
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.