看板 Grad-ProbAsk 關於我們 聯絡資訊
https://i.imgur.com/AwwPZGJ.jpg 如圖 想請問載入時期為什麼不能壓縮? 沒辦法用重新載入解決起始位址改變的問題嗎? 感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 39.8.196.130 ※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1473169955.A.386.html
boy00114: 我自己的理解是因為不是使用dynamic binding的話,一 09/06 21:58
boy00114: 旦程式開始執行了,執行期間就不能變動他在memory 的位 09/06 21:58
boy00114: 置。而dynamic binding 要到exe time才由os決定位置, 09/06 21:58
boy00114: 所以可以用壓縮法任意更動位置 09/06 21:58
shortid: 我的理解是Compaction要搬動process在記憶體中的位址, 09/06 22:15
shortid: 而除了dynamic binding之外的方式是不能在執行中更動位址 09/06 22:15
shortid: 的,因此無法支援compaction,不知道對不對 09/06 22:15
kyuudonut: 重新載入就等於程式重頭開始了耶 09/06 22:58
kyuudonut: 應該說 當你決定dynamic binding時 os就知道要幫你負責 09/06 23:02
kyuudonut: 定位 但你假如是載入時期都決定好了的話 os不會管你 09/06 23:03
kyuudonut: 既然不會管你 compaction這種事更不可能發生 09/06 23:06
kyuudonut: 即使重新載入 loader也不見得知道新的位址在哪裡 09/06 23:07
ken52011219: 我的想法是 process 的PCB 內的值已經被link 於 Read 09/07 14:12
ken52011219: y Q 上 根據 恐龍本的內文「The simplest compaction 09/07 14:12
ken52011219: algorithm is to move all processes toward one en 09/07 14:12
ken52011219: d of memory」 If relocation is static and is done 09/07 14:12
ken52011219: at assembly or load time 時 假如移動the address 09/07 14:12
ken52011219: of the process in memory 了話 PCB內的值勢必需要 09/07 14:12
ken52011219: 更動 否則會使原定process 要在某A處找data 但其實已 09/07 14:12
ken52011219: 經被移到B處 09/07 14:12
ken52011219: 當必須將從memory 已經定位好了重新排序時 必須確定 09/07 14:26
ken52011219: 這些process沒有在被讀取 或者是被設定為無法被變 09/07 14:26
ken52011219: 更的static 位置 重點概念應該還是上述原文的那段 09/07 14:26
w181496: 感謝各位的回答!有點概念了 看來我想的還不夠周全 果然 09/07 15:26
w181496: 還是該看一下原文書 09/07 15:27