Page Size In Power-of-Two

Q1. Why are page sizes always in power-of-two?

Ans. The selection of a power of 2 as a page size makes the translation of a logical address into a page number and page offset particularly easy. If the size of logical address space is 2m, and a page size is 2n addressing units (bytes or words), then the high order m-n bits of a logical address designate the page number, and the ‘n’ low order bits designate the page offset. Thus, the logical address is as follows:

Page Number                                       Page Offset

p D

m-n                                                           n

where ‘p’ is an index into the page table and ‘d’ is the displacement within the page.

 

Leave a Reply

Your email address will not be published. Required fields are marked *