Grad-ProbAsk 板


LINE

※ 引述《wayneshiau (Wayne)》之铭言: : 跟朋友看到一题计概题目如下: : https://imgur.com/a/byDFqa6 : 有点没有头绪该如何计算 : 目前已知A小题应该分别是 : 36 (64GB=2^36) : 2^36/2^12 = 2^24 Frames : 2^32/2^12=2^20 : 想请问 B C小题应该要如何计算? : 谢谢 有错请指正 由题目得知page size 为 4kb(12bits) 因此 32bits virtual address 一定可以先分割成 ------------------ | 20bits | 12bits | ------------------ 但是 physical space 实际上为 64GB, virtual space 为4GB 所以要完整利用 physical space, 因此实际上分为 64/4 = 16个区块 因此可以用 4 bits 来表示区块offset -------------------------- | 4bits | 16 bits | 12bits | --------------------------- 因此这样就完成 single level mapping : 用 2^16 个 size 为 8bytes 的 mapping entries 组成的 page table 来指向 64GB physical memory block 8bytes physical mem ----- -------- -------------- | 0 |----> | 0 | ---------> | | ----- -------- | 4KB | | ... | | 1 | |------------- ----- -------- | 15 | | .... | ...... ----- -------- ------------- | 2^16-1 | | | --------- | 4KB | -------------- 因为 single level page table 需要一次放在memory 中太大了 共需要 2^16 * 8bytes = 2^19 = 512KB 因此假若我把 page table 当成一般的资料看待, 我一样把page table切块 每一块大小依然是 4KB, 因此可以切成 512KB/4KB = 128 个 pages 换句话说也就是 16bits - 7bits = 9 bits 也就是说多加一层的 2 level mapping 会产生: 上层为一个 2^9 个 entries 的 mapping table 而上层 mapping table 的每个 entries 可指到下一层大小为 128 entries 的mapping 而 bottom mapping table 共有 512 个 若我使用 demand paging 实际上我在 memory 中只要放一个完整的 upper mapping + 一个 bottom mapping 共消耗 512*8bytes + 128*8bytes = 5120bytes 也就是下面图 --------------------------------- | 4bits | 9bits | 7bits | 12bits| -------------------------------- block upper bottom phy mem ------ -------- ------- --------- | 0 | ---> | 0 | -----> | 0 | --------> | | ------- --------- ------- | 4kb | | ... | | 1 | | 1 | |------- | ------- -------- ------- | | | 15 | | ..... | | .... | | .... | ------- --------- -------- | | | 511 | --- | 127 | -------- --------- | --------- | | | | 4kb | | | | | --------- --> --------- | 0 | ------- | 1 | ------- | ..... | --------- | 127 | --------- 然後继续切成 level 3(以最後的mapping对齐) ----------------------------------------- | 4bits | 2bits | 7bits | 7bits | 12bits | ------------------------------------------ 因此应该是可以形成 3 level mapping --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.175.69.238 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Grad-ProbAsk/M.1603524355.A.51C.html
1F:推 wayneshiau: 谢谢大大,讲解得非常详细!! 10/25 09:23
2F:推 tv1245987: 推 10/28 22:32







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Boy-Girl站内搜寻

TOP