您的位置:首页 > 移动开发

昨天CSAPP上的疑问的解答

2013-07-22 19:40 225 查看
昨天CSAPP上的疑问的解答

今天整明白了。

CSAPP英文版第2版,826页,或者中文版第2版546页,有这么一段。关于多级页表的。

"But if we had a 32-bit address space, 4KB pages, and a 4-byte PTE[page table entry, 杨注], then we would need a 4MB page table resident in memory at all time..."

其中"32-bit address space"的意思是 2^32 bytes,而不是2^32 bits,因为内存是按字节而不是按比特寻址的。

根据公式:页表尺寸 = (地址空间 / 页尺寸) * PTE入口大小........公式1

32-bit address space: 2^32 bytes (昨天误作bits)

4KB pages: 4K bytes

a 4-byte: 4 bytes

B: bytes



K = 2^10

M = 2^22

代入公式1的右侧,得

(2^32 bytes / 4K bytes) * 4 bytes

= 2^32 * 2^2 / (2^2 * 2^10) bytes

= 2^22 bytes

= 2^2 M bytes

= 4MB

--------------------

博客会手工同步到以下地址:

[http://giftdotyoung.blogspot.com]

[http://blog.csdn.net/younggift]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: