1

圖片問題: enter image description hereOS:內存分配

鑑於以上問題我有幾個問題。首先,proc0代替了一個比它大的孔,剩下的空間會發生什麼?

例如在Q1我:在引入Proc0後它是a. 10->15->15->25->30。有15個替換20個,剩下的5個,所以它會發生什麼,我將如何描述它會發生什麼?它會是一個嗎? 10→5→15→15→25→30或a。 10-> 15-> 5-> 15-> 25-> 30?

+0

這不是在學術界以外使用的符號,所以我不清楚這裏的問題是什麼。 – user3344003

+0

這是一個關於某些特定內存分配算法的問題(似乎關心哪個處理器請求來自哪個處理器),我們對此一無所知。那麼我們如何回答? (或者「Proc」代表處理器以外的其他產品?處理器?我們應該怎麼知道?) –

+0

@DavidSchwartz - 這是一個典型的操作系統問題,它不需要任何處理器來回答;這是一個假設理想情況的理論問題。 –

回答

1

考慮,該proc

SZ的尺寸(PROC 0) - > 15 SZ(PROC 1) - > 5

從什麼我能理解,在Free List (10 -> 20 -> 15 -> 25 -> 30)的變化說明如下:

Q1:第一飛度(自由列表的大小將開始下降)

When proc 0 (size=15) is brought to the list, 
Free List converts to (10 -> 5 -> 15 -> 25 -> 30) 
// the freelist size would decrease wherever the first biggest hole is found, 
// so, hole of size 20 is replaced by a hole of size 5 to allocate memory to proc 0 

When proc 1 (size=5) is brought to the list, 
Free List converts to (5 -> 5 -> 15 -> 25 -> 30) 
// the freelist size would decrease wherever the first biggest hole is found, 
// so, hole of size 10 is replaced by a hole of size 5 to allocate memory to proc 1 

假設空閒列表再次是一樣的(10 -> 20 -> 15 -> 25 -> 30)執行第一嵌入分配之前:

Q2:接下來裝(自由列表的大小將開始下降)

When proc 0 (size=15) is brought to the list, 
Free List converts to (10 -> 5 -> 15 -> 25 -> 30) 
// the freelist size would decrease wherever the next biggest hole is found, 
// so, hole of size 20 is replaced by a hole of size 5 to allocate memory to proc 0 

When proc 1 (size=5) is brought to the list, 
Free List converts to (10 -> 0 -> 15 -> 25 -> 30), or better 
Free List converts to (10 -> 15 -> 25 -> 30) // the size of the freelist decreases. 
// the freelist size would decrease wherever the next biggest hole is found, 
// so, hole of size 5 is replaced by a hole of size 0 
// (or, rather no hole left, so list becomes continuous) to allocate memory to proc 1