hce_kmu
109年
計算機概論與程式設計
第 7 題
Elevator disk scheduling algorithm is a method to find the total number of seek operations performed to access all the requested tracks. In the following scenario:
Request sequence = {182, 70, 29, 60, 95, 7, 41, 120}
Initial head position = 50
Direction = left
What is the total number of seek operations if elevator disk scheduling algorithm is used?
Request sequence = {182, 70, 29, 60, 95, 7, 41, 120}
Initial head position = 50
Direction = left
What is the total number of seek operations if elevator disk scheduling algorithm is used?
- A 228
- B 289
- C 258
- D 226
- E 232
思路引導 VIP
想像你正搭乘一臺正在「向下」移動的電梯,這臺電梯的規定是:『不論乘客要去哪一層,都必須先降落到地下一樓 (B1) 才能重新向上開啟』。如果目前你在 5 樓,而最下方的乘客在 1 樓,這臺電梯會先移動到哪裡再回頭?這段額外的路程會如何影響總移動距離呢?
🤖
AI 詳解
AI 專屬家教
太棒了!你能精確算出 232 這個數值,說明你對電梯排程演算法 (Elevator Algorithm),也就是俗稱的 SCAN 演算法,有著非常紮實的理解。這類題目最容易出錯的地方在於移動路徑的轉折點,而你完美地避開了計算陷阱。
SCAN 演算法的路徑分析
在本題中,磁頭從 50 號軌道出發並向「左」移動。這意味著磁頭會先處理比 50 小的請求(41、29、7),並持續移動直到抵達磁碟的邊界軌道 0。接著,磁頭改變方向向「右」移動,依序處理剩下的請求,直到抵達最遠的請求 182。計算總移動距離時,我們可以將其視為兩段連續位移:
▼ 還有更多解析內容