📜  操作系统|内存管理|问题9

📅  最后修改于: 2021-06-29 22:18:58             🧑  作者: Mango

计算机使用46位虚拟地址,32位物理地址和三级分页页表组织。页表基址寄存器存储一级表(T1)的基地址,该表正好占据一页。 T1的每个条目存储第二级表(T2)的页面的基地址。 T2的每个条目存储第三级表(T3)的页面的基地址。 T3的每个条目都存储一个页表条目(PTE)。 PTE的大小为32位。计算机中使用的处理器具有一个1 MB 16路径集的关联虚拟索引物理标记的缓存。缓存块大小为64个字节。

此计算机中的页面大小(以KB为单位)是多少? (2013年GATE)
(A) 2
(B) 4
(C) 8
(D) 16答案: (C)
解释:

Let the page size is of 'x' bits

Size of T1 = 2 ^ x bytes

(This is because T1 occupies exactly one page)

Now, number of entries in T1 = (2^x) / 4

(This is because each page table entry is 32 bits
  or 4 bytes in size)

Number of entries in T1 = Number of second level 
page tables

(Because each I-level page table entry stores the 
 base address of page of II-level page table)

Total size of second level page tables = ((2^x) / 4) * (2^x)

Similarly, number of entries in II-level page tables = Number
 of III level page tables = ((2^x) / 4) * ((2^x) / 4)

Total size of third level page tables = ((2^x) / 4) * 
                                        ((2^x) / 4) * (2^x)

Similarly, total number of entries (pages) in all III-level 
page tables = ((2^x) / 4) * ((2^x) / 4) * ((2^x) / 4)
            = 2^(3x - 6)

Size of virtual memory = 2^46

Number of pages in virtual memory = (2^46) / (2^x) = 2^(46 - x)

Total number the pages in the III-level page tables = 
                              Number of pages in virtual memory

2^(3x - 6) = 2^(46 - x)

3x - 6 = 46 - x

4x = 52
x = 13

That means, page size is of 13 bits
or Page size = 2^13 bytes = 8 KB 

这个问题的测验