【问题标题】:Calculating size of the page table计算页表的大小
【发布时间】:2014-07-28 13:07:10
【问题描述】:

考虑一台具有 64 MB 物理内存和 32 位虚拟地址空间的机器。如果页面大小为 4 KB,那么页表的大概大小是多少?

我的解决方案:

Number of pages in physical memory = (size of physical memory)/(size of page)
                                   = 64 * 2^10 / 4
                                   = 2^14
Number of pages in virtual memory = (size of virtual memory)/(size of page)
           size of virtual memory = 2^32 bits
                                  = 2^29 bytes
                                  = 2^19 kBytes
Number of pages in virtual memory = 2^19/4 = 2^17
=> Number of entries in page table = 2^17
Size of each entry = 17+14 =31 bits
Size of page table = 31 * 2^17 bits 
                   = 31 * 2^14 bytes
                   = 31 * 2^4 KB
                   = 31*16
                   = 496 KB

但答案是 8 MB。为什么?

【问题讨论】:

    标签: operating-system virtual-memory


    【解决方案1】:

    这个问题已经被问过了。但是,问题中没有足够的信息来确定页表的大小。

    1. 它没有指定页表条目的大小。
    2. 它没有指定映射到进程地址空间的页数。
    3. 它没有指定进程和系统地址速度之间的划分。 32 位中有多少是进程地址空间的一部分。
    4. 它没有指定这是进程表还是系统表。

    【讨论】:

      【解决方案2】:

      8MB 不是答案,
      物理地址空间 = 64MB = 2^26B
      虚拟地址 = 32 位,∴ 虚拟地址空间 = 2^32B
      页面大小 = 4KB = 2^12B
      页数 = 2^32/2^12 = 2^20 页。

      帧数 = 2^26/2^12 = 2^14 帧。

      页表大小 = 2^20×14 位 ≈ 2^20×16 位 ≈ 2^20×2B = 2MB。

      【讨论】:

        猜你喜欢
        • 2013-04-25
        • 2023-03-22
        • 2012-05-28
        • 1970-01-01
        • 2015-07-20
        • 1970-01-01
        • 2011-12-16
        • 1970-01-01
        相关资源
        最近更新 更多