CS 620 (Spring 2008)

Assignment 2

Due Date: 02/28/08 Thursday

The assignment is to handed in class. No late assignments will be accepted.

1. (5 points)

One way to use file system's allocation of a disk and not suffer from holes is to compact the disk (i.e., move the files together to remove the holes) every time a file is deleted. Since all files are contiguous, copying a file requires a seek and rotational delay to read the file, followed by the transfer at full speed. Writing the file back requires the same work. Assuming a seek time of 6ms, a rotational delay of 4ms, a transfer rate of 5MB/sec, and an average file size of 8KB, how long does it take to read a file into main memory and then write it back to the disk at a new location? Using these numbers, how long would it take to compact half of a 16GB disk?

2. (3 points)

In light of the answer to the previous question, does compacting the disk ever make sense? Explain your answer.

3. (3 points)

Two computer science students, John and Mary, are having a discussion about i-nodes. John maintains that memories have gotten so large and so cheap that when a file is opened, it is simpler and faster just to fetch a new copy of the i-node into the i-node table, rather than search the entire table to see is it is already there. Mary disagrees. Who is right? Justify your answer.

4. (4 points)

List four ways a system could use to determine which blocks on a disk are free.
Give advantages of each way.

5. (4 points)

In some systems, a subdirectory can be read and written by an authorized user (not just the owner), just as ordinary files can be.
(a) Describe a protection problem that could arise.
(b) Suggest a scheme for dealing with the protection problem you named in part (a).

6. (4 points)

(a). What problems might arise if a file being currently opened by several users is deleted?
(b). How can we solve this problem?

7. (3 points)

What are the advantages and disadvantages of recording the name of the creating program with the file's attributes (as is done in the Macintosh operating system)?

8. (8 points)

Suppose that an inode is 128 bytes, pointers are 4 bytes long, and the status information takes up 68 bytes. Assume a block size of 8K bytes and block pointers of 32 bits each.

(a) How much room is there for direct pointers in the inode?

(b) How big a file can be represented with direct pointers?

(c) How big a file can be represented with single Indirect pointers?

(d) How big a file can be represented with Double Indirect pointers?

(e) How big a file can be represented with Triple Indirect pointers?

9. (2 points)

Consider a system that supports 5000 users. Suppose you want to allow 4990 of these users to be able to access one file. How would you specify this protection scheme in UNIX?

10. (6 points)

Consider the following backup scheme:

Day 1. Copy to a backup medium all files from the disk.
Day 2. Copy to another medium all files changed since day 1.
Day 3. Copy to another medium all files changed since day 1.
This differs from the schedule given in Section 11.7.2 in the textbook by having all subsequent backups copy all files modified since the first full backup.
(a). What are the benefits of this system over the one in Section 11.7.2? (2 points)
(b). What are the drawbacks? (2 points)
(c). Are restore operations made easier or more difficult? Explain your answer (2 points).

11. (6 points)

Consider a file system on a disk that has both logical and physical block sizes of 512 bytes. Assume that the information about each file is already in memory and each disk address contains 1 bytes. For each of the three allocation strategies (Contiguous, linked, and indexed), answer these questions:

(a) How is the logical-to-physical address mapping accomplished in this system? (For the indexed allocation, assume that a file is always less than 512 blocks long.)
(b) If we currently at logical block 10 (the last block accessed was block 10) and want to access logical block 4, how many physical blocks must be read from the disk?

12. (2 points)

How many disk operations are needed to fetch the i-node for the file /home/teacher/courses/os/handout.html? Explain your answer. Assume that the root directory is in memory, but nothing else along the path is in memory. Assume also that each directory file fits in one block.

**********************************************************************

Return to the CS 620 Home Page