计算页表大小 [英] Calculating Page Table Size
问题描述
我正在阅读页表的示例,并且发现了这一点:
I'm reading through an example of page tables and just found this:
请考虑具有32位逻辑地址空间的系统.如果在这样的系统中页面大小为4 KB(2 ^ 12),则页面表最多可以包含一百万个条目(2 ^ 32/2 ^ 12).假设每个条目包含4个字节,则每个进程可能仅对于页表就需要多达4 MB的物理地址空间.
Consider a system with a 32-bit logical address space. If the page size in such a system is 4 KB (2^12), then a page table may consist of up to 1 million entries (2^32/2^12). Assuming that each entry consists of 4 bytes, each process may need up to 4 MB of physical address space for the page table alone.
我不太了解这4MB的结果.它代表实际的页表占用的空间吗?
I don't really understand what this 4MB result represents. Does it represent the space the actual page table takes up?
推荐答案
由于我们的虚拟地址空间为 2 ^ 32 ,并且每个页面的大小为 2 ^ 12 ,我们可以存储(2 ^ 32/2 ^ 12)= 2 ^ 20页.由于此页表中的每个条目的地址大小均为4个字节,因此我们有 2 ^ 20 * 4 = 4MB .因此,页表占用4MB内存.
Since we have a virtual address space of 2^32 and each page size is 2^12, we can store (2^32/2^12) = 2^20 pages. Since each entry into this page table has an address of size 4 bytes, then we have 2^20*4 = 4MB. So the page table takes up 4MB in memory.
这篇关于计算页表大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!