Question

I am studying Computer Systems. I have th following question and its answer:

Given the logical address 0xAEF9 (in hexadecimal) with a page size of 256 bytes, what is the page number?

Answer: 0xAE (I found this answer in the web, but I want to know how can I figure it out myself?

How can I figure out the page number for a given logical address?

Was it helpful?

Solution

Your logical address is made of 16 bits, that means you have a addressable space of $2^{16}$ bits. The page size is typically a power of 2, $2^n$, in this case $2^n = 256 \Rightarrow n = 8$.

The page number is calculated by substracting $n$ from the size of your logical address: $16 - 8 = 8$, so the first 8 bits of the address are your missing page number, that is 0xAE

OTHER TIPS

Logical address includes both page number and the offset within the page.
Your logical address is 16 bit.

Page size as mentioned is 256 = 28. It means that 8 bit address is necessary to address any word within the page. The least significant 8 bits are used for this purpose (as offset address)

The remaining bits (the most significant 8 bits) are used as page number.
So the fist 8 bits specify the page number. 0xAE in this case.

Page Number=Logical Address/Page Size

AEF9 converted to decimal-> 1*9+16*15+16^2*14+16^3*10 = 44793

44793/256=174

174 in hexa-> AE

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top