Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Assume a block size of 4k and that an inode has 12 direct pointers, 3 indirec

ID: 3640607 • Letter: 1

Question


1.
Assume a block size of 4k and that an inode has 12 direct pointers, 3 indirect
pointers, 1 double indirect pointer and 1 triple indirect pointer (while all other
indirect blocks have 16 pointers). How many block reads are required to read a
file of size 1,378,000 bytes. Assume no cache and that all data must be fetched
from disk.
2.
In the Unix operating system, suppose the root directory “/” inode is in memory,
and everything else is not in memory, assuming that all directories fit in one disk
block, how many disk accesses are needed to read the first file block of
“/home/alice/cs323/homework/report.txt”? Describe the purpose of each disk
access.
3.
Name one advantage of hard links over symbolic links and one advantage of
symbolic links over hard link

Explanation / Answer

1) 3 because one data block and two other data blocks pointed by the one indirect block 3)symlinks can cross file systems, hard links can't. If you delete the original file, the hardlink still keeps it alive, a symlink doesn't. A hard link essentially means the file lives in two places, it can have different permissions, you can delete it in on place but not the other. A soft link is just a pointer to the real thing. A hard link is two (or more) directory entries pointing at the same file. A soft link is a directory entry pointing at another directory entry When deleting files, the data part isn't disposed of until all the filename parts have been deleted. There's a count in the inode that indicates how many filenames point to this file, and that count is decremented by 1 each time one of those filenames is deleted. When the count makes it to zero, the inode and its associated data are deleted. By the way, the count also reflects how many times the file has been opened without being closed (in other words, how many references to the file are still active). This has some ramifications which aren't obvious at first: you can delete a file so that no "filename" part points to the inode, without releasing the space for the data part of the file, because the file is still open.