# 題目
* 林子皓
Explain the File Open process in an operating system.
ANS:
step1:user process issues an open() system call
step2:kernel accesses the directory structure to locate the file. It checks if the file exists and retrieves its metadata.
step3: kernel retrieves the File Control Block (FCB) from secondary storage
* 楊秉沅
There are File systems A,B and C,that use contiguous,linked and indexed allocation.A file of size 20 blocks is already stored on A,B and C.
Now, we want to update the file,so need to inserting a new block in the file(between 7th and 8th block ),whose data is already avalible in the memory.
Assume that there are enough free blocks at the "end" the file and that the FCB are already in memory.
Let the number of disk accesses required to insert a block in the A,B and C are a,b and c respectively.What are the value of a,b,c?
Ans.
a=13 read +13 write + 1 write newly inserted block=27
b=7 read +1 delete next pointer of the 7th and write next pointer to newly insert block +1 to connect it to the 8th(write newly inserted block)=9
c=1 write the index block+1 write newly inserted block=2
* 王尚鵬
Which of the following statement is true?
(A) If we want to use Contiguous allocation, we must know starting location and length.
(B) Sorting the files name will slow down the linear search time.
\(C) Sector is the biggest physical storage unit on hard disk.
(D) Contiguous allocation is good and efficient at dynamic size entries.
Ans:(A)
Explain:
(B) speed up.
\(C) snakkest.
(D) only good at fixed size entries.
* 楊閔恩
What are the steps to open a file? Please explain the steps.
Ans:
1. Check the directory structure to locate the file and confirm its existence, loading any missing directory information from the disk into memory if necessary.
2. Use the pointers in the directory to locate and read the corresponding File Control Block (FCB) from the disk.
3.Load the FCB to the system-wide OpenFile table in memory for further operations.