作者lovefo (lovefo)
看板Grad-ProbAsk
標題[理工] [OS]-成大98-資工
時間Tue Mar 2 11:39:36 2010
Suppose that a disk drive has 5000 cylinders,numbered 0 to 4999.The drive is
currently
serving a request at cylinder 143,and the previous requeest was at cylinder
100.The queue of
pending requests,in FIFO order is
86,1470,913,1774,948,1509,1022,1750,130
Starting from the current head position,what is the total distance (in
cylinders) that the
disk arm moves to satisfy all the pending requests if the C-LOOK
disk-scheduling algorithm is used?
143 -> 913 -> 948 -> 1022 -> 1470 -> 1509 -> 1750 -> 1774 -> 86
770 35 74 448 39 241 24 1688
-> 130
44
770+35+74+448+39+241+24+1688+44=3363
我算出來 答案是3363
和某位大大算出來有極大的差異
不知道我是哪裡錯了
希望其他大大能給我指教
--
一切....
似乎不再那麼重要....
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.46.167.38
推 lightergogo:沒錯阿 03/02 11:45
推 polomoss:沒錯~ 03/02 12:06
→ polomoss:還有你不需要每個加~~用尾巴去減比較快 03/02 12:06
推 newman1125:我算的是 (4999-143) + (130-0) = 4986 不是ㄇ? 03/02 12:49
推 yesa315:原PO正確 相信自己一點! 03/02 13:32
推 daven329:(1774-143)+(1774-86)+(130-86)=3363 03/02 13:42
→ polomoss:樓上正解,這樣比較快 03/02 14:11