How do i find bits in virtual and physical address?

user3233721 picture user3233721 · Apr 29, 2015 · Viewed 7.5k times · Source

The question is:

Consider a virtual address space of 256 pages with page size of 4KB, mapped onto a physical memory of 128 frames. How many total bits are required in the virtual address? How many total bits are required in the physical address?

I can't figure out how to number of frames is used with the number of pages to find the bits required.

Can someone explain the steps required to solve this problem?

Answer

user3344003 picture user3344003 · Apr 30, 2015

I'll bite, as much as I hate these theoretical problems with not practicable use:

There are 256 pages in the virtual address space. That means 8 bits are a required to identify a page.

The page size is 4096 bytes. It takes 12 bites to represent that many of bytes.

Therefore, you need 20 (8+12) bits for a virtual address.

There are 128 page frames. That requires 7 bits.

Therefore, you need 19 (7+12) bits for a physical address.