[理工] 100交大OS+計組

看板Grad-ProbAsk作者 (Transfat)時間7年前 (2017/01/14 22:45), 編輯推噓3(3024)
留言27則, 3人參與, 最新討論串1/1
[100交大計組] 11(b) Before DMA transfer. DMA controller must notify processor by supplying identity of the device,operation, memory addrss, number of bytes to transfer,etc. 我知道DMA在傳data之前要先去跟CPU問說可不可以傳,我想問這題錯在DMA是都不會去提供這些資訊嗎還是? [100交大OS] 05. Consider a tiny paging system has 16KB physical memory, and the frame size is 1KB. Let the logical address have 16 bits. The page table uses single-level direct index. Which one of the following is not correct? (c)There are 16 entries in the page table (e)The page table requires 320 bits , including the vaild-invaild bits. 竟然卡住了,這題應該假設page size=frame size去算(吧),所以page offset=10,page index+tag=16-10=6 frame number=4 bits(因為有16個frame),想問(c)和(e)是? 謝大家 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.25.105 ※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1484405114.A.6F7.html

01/14 22:54, , 1F
OS(5),page index有6個bits,所以page table有2^6=64
01/14 22:54, 1F

01/14 22:54, , 2F
個entry
01/14 22:54, 2F

01/14 22:55, , 3F
physical memory內有16KB/1KB=16個frame,所以PPN需要
01/14 22:55, 3F

01/14 22:56, , 4F
4個bits,加上valid-invalid bit,一個entry需5個bits
01/14 22:56, 4F

01/14 22:56, , 5F
page table就需要64*5=320bits
01/14 22:56, 5F

01/14 22:59, , 6F
100-11(b)應該是processor去notify DMA controller?
01/14 22:59, 6F

01/14 23:04, , 7F
龍書是寫CPU設定device controller, 後者在設定DMA
01/14 23:04, 7F

01/14 23:04, , 8F
我覺得有點奇怪就是
01/14 23:04, 8F

01/14 23:06, , 9F
阿我想起來了,這些東西是CPU去設定device controller,
01/14 23:06, 9F

01/14 23:07, , 10F
Device controller再下command給DMA
01/14 23:07, 10F

01/14 23:13, , 11F
我看到龍書的一段話:
01/14 23:13, 11F

01/14 23:14, , 12F
To initiate a DMA transfer, the host writes a DMA
01/14 23:14, 12F

01/14 23:14, , 13F
command block into memory.This block contains...
01/14 23:14, 13F

01/14 23:15, , 14F
(就是那些東西).The CPU writes the address of this
01/14 23:15, 14F

01/14 23:15, , 15F
command block to the DMA controller,then goes on
01/14 23:15, 15F

01/14 23:15, , 16F
with other work.
01/14 23:15, 16F

01/14 23:17, , 17F
這邊的host應該就是device controller的意思?
01/14 23:17, 17F

01/14 23:18, , 18F
不過直接看龍書給的圖的確是T大和k大那樣說的沒錯
01/14 23:18, 18F

01/14 23:18, , 19F
不過這裡又寫CPU writes the address of this command
01/14 23:18, 19F

01/14 23:19, , 20F
block to DMA controller,感覺又有點像CPU在做的
01/14 23:19, 20F

01/14 23:19, , 21F
張凡的書是直接寫:處理器對DMAC進行設定,包括提供...
01/14 23:19, 21F

01/14 23:21, , 22F
(就是那些東西),這樣感覺有點差異,不過都不會是DMA去
01/14 23:21, 22F

01/14 23:21, , 23F
notify CPU就是了
01/14 23:21, 23F

01/14 23:21, , 24F
對阿 我覺得超怪的 龍書有兩種寫法 但應該還是要看
01/14 23:21, 24F

01/14 23:21, , 25F
實作啦 @@
01/14 23:21, 25F

01/14 23:30, , 26F
也許那段話是包含在圖的第三個步驟也說不定XD
01/14 23:30, 26F

01/14 23:30, , 27F
感覺我好鑽牛角尖...
01/14 23:30, 27F
文章代碼(AID): #1OUZbwRt (Grad-ProbAsk)