[考題] 計算機概要

看板Examination作者 (八八八)時間11年前 (2013/02/28 21:17), 編輯推噓2(205)
留言7則, 2人參與, 最新討論串1/2 (看更多)
想請教一下以下兩題的差異 1. 在一個分頁系統(paging system)中,假設邏輯位址(logical address)為32 bits, 分頁大小(page size)為4K bytes,實體記憶體(physical memory)為256M bytes。 系統使用反分頁表(inverted page table)且每一分頁表項目(page table entry)占 4 bytes。 假設目前有3個程序在系統中,則該系統需要用多少實體記憶體來存目前整個系統的分頁表? A)12M bytes B)48K bytes C)12K bytes D)256K bytes Ans: D) 2. 在一個分頁系統(paging system)中,假設邏輯位址(logical address)為32 bits, 分頁大小(page size)為4K bytes,實體記憶體(physical memory)為256M bytes。 此系統使用單一層次分頁表(single-level page table)且每一分頁表項目(page table entry)佔4 bytes。假設目前有3個程序(processes)在系統中,則該系統最多需要用多 少實體記憶體來存這些程序的分頁表? A)12M bytes B)48K bytes C)12K bytes D)256K bytes Ans: A) 看起來都一樣吧,但為何答案不同? 還是說有陷阱! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 112.104.106.52

02/28 23:39, , 1F
一個系統是用反分頁表,一個系統是用單一層次分頁表!!
02/28 23:39, 1F

02/28 23:47, , 2F
32 bits - offset 12 bits = 20 bits
02/28 23:47, 2F

02/28 23:48, , 3F
故page table size = page entry*2^20 = 4M bytes
02/28 23:48, 3F

02/28 23:53, , 4F
single level 因為3個process獨立 故4M*3 = 12M
02/28 23:53, 4F

03/01 00:02, , 5F
若使用inverted page table 256M/4K = 2^16 K bytes
03/01 00:02, 5F

03/01 00:02, , 6F
inverted page table entry 數 = memory frame 數
03/01 00:02, 6F

03/01 00:03, , 7F
每個entry 4 byte 故table size = 2^16*4 = 256 KB
03/01 00:03, 7F
文章代碼(AID): #1HBra6o7 (Examination)
文章代碼(AID): #1HBra6o7 (Examination)