看板 Grad-ProbAsk 關於我們 聯絡資訊
看不太懂張凡這題的解答>< http://i.imgur.com/sRral9v.jpg
-- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 182.235.130.102 ※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1483363607.A.833.html
yupog2003: 對於read from I/O來說,不管是write through或write 01/02 22:27
yupog2003: back,DMA從IO讀資料進memory都不會改變cache中的資料 01/02 22:28
yupog2003: CPU要讀資料的時候發現cache已經有他要的資料了,就不 01/02 22:28
yupog2003: 會再去memory找,殊不知,memory中的資料才是從I/O讀進 01/02 22:29
yupog2003: 來最新的資料,因此CPU總是拿到舊資料 01/02 22:29
yupog2003: 對於write to I/O來說,採用write back會導致CPU寫入 01/02 22:30
yupog2003: cache時不會立即更新memory中的資料,而DMA要寫資料到 01/02 22:31
yupog2003: I/O只會從memory抓資料來寫入,如此一來,DMA就會抓到 01/02 22:31
yupog2003: 舊資料了 01/02 22:31
yupog2003: 但採用write through的話,CPU寫入cache時同時更新 01/02 22:32
yupog2003: memory中的資料,因此DMA在抓資料來寫入I/O時,就會抓 01/02 22:33
yupog2003: 到從CPU吐出來最新的資料,因此不會產生問題 01/02 22:33
yupog2003: 感覺我只是把解答翻譯成中文然後口語化一點,不知道有 01/02 22:35
yupog2003: 沒有幫助XD 01/02 22:36
h9638512: 解釋的好清楚 非常感謝你!! 01/02 22:38