Given the logical address, how to extract the page number?

Question Detail: 

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?

Asked By : malhobayyeb
Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/11719

Answered By : Alejandro Sazo

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

No comments

Powered by Blogger.