Question

I have this problem for homework that I am having a hard time finding an answer for. Was wondering if anyone here could tell me if I am on the right track on my calculations or if I am way off. I am not looking for someone to GIVE me the answer. Any help pointing me in the right direction if my answer is incorrect would be greatly appreciated. Here is the problem:

The virtual address space of a process is 2 MB large. Assume that the size of a page is 4KB. What is the maximum size of a page table in memory if each page table entry requires 2 bytes?

The logic behind my calculation is that each page is 4096 bytes (4KB) in size and each page table entry is 2 bytes. So, each page essentially takes up 4098 bytes of memory. If I divide 2MB by the total amount of memory for each page I can have a maximum of 511 pages in memory. (The 512th page is the page table). Each page requires a page table entry so therefore 511 pages * 2 bytes = 1022 bytes is my max page table size for this problem.

Am I in any way on the right path here? Or is there a different way I should be calculating this? Any tips or suggestions will be greatly appreciated. Thanks in advance.

Était-ce utile?

La solution

The page table isn't considered to be part of the virtual space, but a means of IMPLEMENTING virtual memory, so don't use it in counting pages.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top