[File System and Disk: 10%] (1) Except for single-level and two-level directories, what are the three popular schemes to define the logical structure of directories? (3%)
(2) Suppose that the range of a disk's cylinders is [1, 200] and the disk head currently stops at cylinder 55. Let the disk queue contain the requests of blocks on cylinders {99, 187, 39, 124, 14, 131, 65, 70}. Please show how the disk head moves in the SSTF, SCAN, C-SCAN, and C-LOOK disk scheduling schemes. (6%)
(3) What is a component unit of the distributed file system? (1%)
(1) tree-structured directory:可建子目錄形成樹,每個檔案有唯一 path,不能共享
acyclic-graph directory:允許目錄或檔案被多處 link 而共享,不許有環,要用 reference count 決定刪除
general graph directory:允許有環,彈性最大,但走訪可能無窮迴圈,需要 garbage collection 回收
(2) head 在 55,請求 14, 39, 65, 70, 99, 124, 131, 187;SCAN、C-SCAN、C-LOOK 先往大號方向
SSTF:55 → 65(10)→ 70(5)→ 99(29,比回頭 39 的 31 近)→ 124(25)→ 131(7)→ 187(56)→ 39(148)→ 14(25)
\(10+5+29+25+7+56+148+25=305\)
SCAN:往上到 187,走到邊界 200 再折返往下
\((200-55)+(200-14)=145+186=331\)
C-SCAN:往上到 200,直接跳回 1,再往上
\((200-55)+(200-1)+(39-1)=145+199+38=382\)
C-LOOK:往上到最後一個請求 187,直接跳到最小請求 14,再往上
\((187-55)+(187-14)+(39-14)=132+173+25=330\)
括號是只經過不服務的位置;C-SCAN、C-LOOK 總量含折返那一段(不含則 183、157)。若 SCAN 先往小號方向:55 → 39 → 14 → 1 → 65 → … → 187,共 \((55-1)+(187-1)=240\)。
(3) component unit:可以獨立存放在單一機器上的最小檔案集合(同一 unit 的檔案必在同一處)