Pаrt II – Questiоn 6: File Systems (30 pоints) Nоte: Cаnvаs will not grade this question. Work on your separate answer sheet. Submit the answer sheet via Canvas Inbox (preferred) or email within 10 minutes after the exam ends. (a) (10 points) A file system uses inodes with the following structure: 10 direct data-block pointers 1 single indirect pointer 1 double indirect pointer (no triple indirect) Pointer size = 8 bytes (i) (4 pts) With a block size of 2 KB, report: N (pointers per indirect block), direct capacity (KB), single-indirect capacity (KB), double-indirect capacity (MB), and approximate total max file size (MB). (ii) (3 pts) Now block size is halved to 1 KB, all other parameters unchanged. Report the same five quantities as in (i). (iii) (3 pts) Answer the following: Shrinkage factor = total from part (i) ÷ total from part (ii) Which level contributes most to the shrinkage (direct / single / double)? Why that level dominates. (b) (10 points) A file system uses the VSFS layout. Inodes have 12 direct pointers plus 1 single indirect pointer. Block size = 4 KB; each directory fits in a single data block. A user process executes: int fd = open("/home/alice/project/src/main.c", O_RDONLY); read(fd, buf, 60 * 1024); // read the entire 60 KB file The root directory's inode number is a well-known constant (e.g., inode 2), so the OS does not need to search the disk to find which inode belongs to the root. However, reading the root inode's contents from disk (to obtain its data-block pointers) and reading the root directory's data block are still disk I/Os that must be counted. (i) (5 pts) Assume no caching. Report: path depth d, open() disk reads (formula 2d + 1), number of file data blocks to read, indirect-block reads (0 if the file fits in direct pointers), read() disk reads (data + indirect), and the total disk reads. (ii) (3 pts) Now the inode of /home/alice/ and the data block of /home/alice/ are already cached in memory. Report: number of reads skipped by the cache, new open() disk reads, read() disk reads (unchanged from part (i)), and the new total disk reads. (iii) (2 pts) For a workload that repeatedly opens and reads many different files located under the same directory tree (e.g., a compiler recursively reading every source file under /home/alice/project/), which category of cached structures reduces disk reads the most? Choice (circle one): directory inodes & directory data blocks / file data blocks. Provide a brief justification. (c) (10 points) A file system uses journaling with the standard three-step protocol (journal write → commit marker → checkpoint). A process performs a write() call that appends one new data block to an existing file. A power failure occurs at one of two different moments during the update: Crash A: The journal write (step 1) has completed and been persisted to disk. The commit marker has not yet been written. Crash B: The commit marker (step 2) has been written to disk. The checkpoint (step 3) has not yet completed — the real bitmap / inode / data-block locations have not yet been updated. (i) (6 pts, 1 pt per cell) For each crash scenario, report: recovery action, whether the user's write is reflected after reboot (Yes / No), and whether the file system is consistent after recovery (Yes / No). (ii) (4 pts) A student claims: “Because of journaling, once a write() system call returns, no data can ever be lost even if the machine crashes immediately afterward.” Is this claim correct? (Correct / Incorrect) Which crash scenario best supports your answer? (A / B) Justification.