# I need help with virtual memory problem

• Given the above virtual to physical address mapping,

1 What is the page size?

2 How many virtual pages can we have in maximum?

3 How many physical pages can we have in maximum?

Approach:

1 For the page size I would say I don't know because we have no information that gives us a clue about page size.

2 I think that we can have as many as the number of physical frames in memory

3 As many as we want, but since we have to constrain the number pages to the number of bits in the address then I would say 2^15 pages.

Can you give me some insight to get to the right idea to solve this problem?

• The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you! – Raphael Feb 4 '17 at 10:42

A quick search reveals that

• POFS is page offset.

• VPN is virtual page number.

• PFN is page frame number.

Since the page offset is 13 bits long, assuming that the page is byte-addressed, the conclusion is that page size is $2^{13}$ bytes.

I trust that you can solve the other parts in a similar way, especially having been taught these concepts in class.

• hey Yuval Filmus. Thank you so much for your concise answer. As far as I understand, page size is basically the size of one block in the page table, so you are basically saying that if the page offset is 13 bytes then there must be 2^13 addressable pieces of data in one block. – TheMathNoob Dec 6 '16 at 7:48
• Yes, that's my hunch, but I don't know anything about this area. Presumably you studied it in class and so is better poised at answering your own question. – Yuval Filmus Dec 6 '16 at 7:57
• For the number of virtual pages I would say 2^19 virtual pages and the number of POFS I would say 2^15 pages – TheMathNoob Dec 6 '16 at 7:58
• One more question why is it 2^13 bytes and not 2^13 bits? – TheMathNoob Dec 6 '16 at 8:09
• We don't verify solutions here. I can help you with any conceptual difficulties, but not beyond that. – Yuval Filmus Dec 6 '16 at 8:22

The first part of the question has been been correctly addressed . For the second part imagine if the number of virtual pages were to be equal to the number of physical pages there would be no benefit of the virtual memory. The number of virtual pages is $2^{20}$. That is the remaining bits of the virtual address.

Usually in the implementation of the OS it is the PAGE SIZE and the FRAME SIZE which matches.hence the number of page offset bits in virtual and physical address is same. Number of physical frames can be found by the remaining bits of the physical address.