2. 3. 4. 5. 6. 7. 8. 9. File System Reads and Writes Suppose we have a directory
ID: 3828486 • Letter: 2
Question
2.
3.
4.
5.
6.
7.
8.
9.
File System Reads and Writes Suppose we have a directory structure as follows: Suppose the contents of the root directory and its inode, and the contents of directory A and A's inode, are cached in main memory. List out all the disk read and write operations (to directories, files inodes) needed to create a new 1 fie called "file100" in directory A. Explain the reason for each read and write. For example, if the root inode and the root directory was not cached, you would have a line item that says the following: Read root inode rightarrow determine location of root directory on diskExplanation / Answer
Considering all the files in Directory A are 1 disk block in size.
Assuming that the File 100 in Directory A -is the 3rd file in the same directory.So we have to traverse through previous 2 files in directory A.
As the contents of the Root Directory & its i-node and the contents of Directory A & its i-node are cached in main memory ,so there is no need of any disk read or write operation to reach to Directory-A.
Read 2 times 1block file -->traverse through all the linked list to reach at the end of last file(2nd) pointer.
Write 1 --> the pointer in the 2nd block to point to the new 3rd block of File100
Write 1--> 1 block of File100
Write 1-->write the i-node of File100
Write 1- update i-node of Directory-A with the new file size and other attributes.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.