Lecture 13 homework: Unix Files and Directories

Handed out: Saturday, October 16, 2004
Due: Monday, October 25, 2004
Read: chapters 18 and 19 plus source.

Hand-In Procedure

You are to turn in this homework during lecture. Please write up your answers to the exercises below and hand them in to a 6.828 staff member by the end of the lecture.

File and Directory I/O

In preparation for the lecture about the unix V6 file system, read the V6 code carefully. You should have a good idea of the big picture.

Now answer these questions:

Suppose a program creates a file "foo", writes 1 byte (containing "a") to it, calls close, and the power fails right after the call to closef() on line 5854 completes. What are the possible states that the disk is in? More specifically:

Exercise 1. Is there an inode for "foo" stored on the disk? If so, what are its contents?

Exercise 2. Is there a data block for "foo" stored on the disk? If so, what are its contents?

Exercise 3. Is there a directory entry for "foo" on disk? Why? Why not?

This completes the homework.

This completes the PDP11 homeworks!