简体   繁体   English

虚拟内存到物理转换?

[英]Virtual Memory To Physical Translation?

My book had the following image:我的书有以下图片:

在此处输入图片说明

And a question of how many PTE's are there in L2 (or L1), the answer was 16 = 2^4 but why is that?关于 L2(或 L1)中有多少个 PTE 的问题,答案是 16 = 2^4 但这是为什么呢?

In the question it's given that each PTE size is 2 bytes so the answer should be 2^4/2 = 8 Since L2 index holds where we will point to.在问题中,给出每个 PTE 大小为 2 个字节,因此答案应该是 2^4/2 = 8 因为 L2 索引保存我们将指向的位置。 For example if it's 2 then it point to second half of the first PTE and not the second PTE.例如,如果它是 2,那么它指向第一个 PTE 的后半部分,而不是第二个 PTE。

What am I missing here?我在这里缺少什么?

You are overthinking.你想多了。 There are 4 bits used to index the L1 page table entry, so there are 2^4 possible values for this index and thus 2^4 possible page tables entries.有 4 位用于索引 L1 页表条目,因此该索引有 2^4 个可能的值,因此有 2^4 个可能的页表条目。

The size of a page table entry is not relevant to this question.页表条目的大小与此问题无关。 It is asking "how many", not "how large".它是问“多少”,而不是“多大”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM