1
votes

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?

2
This is more about computer architecture or basic computer science, not programming. cs.stackexchange.com would probably be a better place for it, you might even be able to find the answer already there.Barmar
I wouldn't really call it basic computer science, but thanks for pointing me to a better site to ask the question on. If it was so basic, why wouldn't you just help me out and answer it, even a little bit? Im not looking for the direct answer, just some help solving it. If the tags were not included like page-size and virtual address space, i would agree in the fact this is not the right site. but they are thereuser3233721
I didn't mean simple.Barmar
SO has a long history, that predates the creation of more specific SE sites. It used to be used for more general discussion, so there are lots of tags like that. There are also many occasions when these tags are relevant to writing computer programs.Barmar

2 Answers

0
votes

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.

0
votes

There are also the offset bits when talking about the physical memory. So assuming an offset which can fit in 8bits, it would be indeed 7 + 12 but you have to take into account 8 more bits. Generally speaking offset equals [logical_address]mod[page_size].