1
$\begingroup$

If the page size is 4Kbyte and the physical size of the main memory is 32Kbyte. Now if I consider virtual address of 37064..

The page number is then 37064/4096 = 9

And according to my diagram page 9 is mapped to frame 6

But how do I calculate the offset? According to exercise it should be 200. Thank you

$\endgroup$
1
  • $\begingroup$ Hint: do the exercise in hexadecimal. A 4 kilobyte page is exactly 0x1000 bytes long. $\endgroup$
    – MSalters
    Jan 25 at 10:59
1
$\begingroup$

The page size indicates how much bits represent the offset in the physical frame. In this case you have pages of 4KB that means you need 12 bits because 2^12 = 4096. The offset in the physical frame always starts at the least significant bits. So for your example with

37064 = 0b1001 0000 1100 1000,

0000 1100 1000 = 200 in decimal is the offset in the physical frame. Since you have only one level of page tables, the rest of the bits to the left represent the actual physical page. You should not see it as a division even though it works. So the offset in the page table is 1001 = 9.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.