Re: [理工] [計組] write back

看板Grad-ProbAsk作者 (強迫)時間14年前 (2011/08/24 23:50), 編輯推噓3(308)
留言11則, 4人參與, 最新討論串2/4 (看更多)
※ 引述《mqazz1 (無法顯示)》之銘言: : 張凡下冊290頁 題58 : (3) In today's computer systems, virtual memory and cache work together as a : hierarchy. When the operating system decides to move a page back to disk, : the contents of that page may have been brought into the cache already. : What should the OS do with the contents that are in the cache? : ===== : Force the related blocks to write back if they are dirty or invalid the : related blocks if they are clean. : 請問它的題目跟解答是在說什麼@@? : 謝謝 意思是說 假如現在某個page在memory 在這個page的某段資料 並且被搬到Cache以後 現在想要把這page從memory移除 該如何做? 被搬到cache的某個line 它的valid bit=1 也就是說它是有效的 只把memory理page內容直接搬回disk 可能會有問題 搬回disk的資料跟留在cache的資料不一樣 A 如果這個cache line他沒有被修改過 dirty bit = 0 那麼直接把他的valid bit設成0 最後把page寫回disk B 如果這個cache line被修改過 dirty bit = 1 表示現在page的某段資料跟cache line資料並不一樣 先把cache line的資料write back回memory 在把valid bit設成0 最後把這page寫回disk -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.34.83.238

08/25 01:39, , 1F
其實A這個case不用把page寫回disk,不過這段我還沒上到,只
08/25 01:39, 1F

08/25 01:40, , 2F
是純粹用OS的觀念來看的想法。
08/25 01:40, 2F

08/25 01:41, , 3F
如此一來可節省一次I/O
08/25 01:41, 3F

08/25 10:29, , 4F
謝謝
08/25 10:29, 4F

08/25 12:11, , 5F
如果在這之前page的資料在某line被修改過 又已經被寫
08/25 12:11, 5F

08/25 12:12, , 6F
回page 就需要
08/25 12:12, 6F

08/25 12:12, , 7F
其實也要看page的dirty bit為何
08/25 12:12, 7F

08/25 12:14, , 8F
這題應該只是問OS怎麼操作cache
08/25 12:14, 8F

08/25 22:22, , 9F
嗯,後來想想沒考慮到同個page進cache又出cache再回去的情
08/25 22:22, 9F

08/25 22:23, , 10F
況,這樣cache內的dirty為0且page的dirty bit卻為1。
08/25 22:23, 10F

09/11 14:29, , 11F
09/11 14:29, 11F
文章代碼(AID): #1ELHtDdP (Grad-ProbAsk)
文章代碼(AID): #1ELHtDdP (Grad-ProbAsk)