CS414 Homework 5.  Ungraded; solutions will be posted.

 

1.      Suppose that a file with contents F that has two “names” in the file system, A and B.  You delete the file by deleting name B, then create a new file with contents F’ and give it this same name, B.

    1. If A was a “symbolic link” and B was a “true link” (e.g. A was a symbolic link to B) and you print A, would you see the original file contents, F, or the modified contents, F’?
    2. If A was a “true link” and B was a “symbolic link” ” (e.g. B was a symbolic link to A) and you print A, would you see the original file contents, F, or the modified contents, F’?
    3. If A was a “true link” and B was a “true link” and you print A, would you see the original file contents, F, or the modified contents, F’?

 

2.      Suppose that you carefully measure file copy times on your PC and discover that for files up to 8 blocks in length, copying occurs at 550KB/sec.  As the file grows to include even a single byte of the 9’th block copying suddenly slows down to 500KB/second.  You check a bunch of larger files and this 500KB/second number is typical for most of them, but there are a few enormous files on your computer for which copying is even slower: 400KB/second.  Explain why you are getting these different numbers.

 

3.      Suppose that a new generation of disks will use special laser optical access technology with no moving parts.  This technology has identical access time for all blocks on the disk no matter where the block is located.  Would the file system need to worry about placement of blocks close to inodes or file fragmentation when using such a disk?  (In fact a form of this type of disk already exists – memory sticks for digital cameras and PDA’s are treated like a disk but because the actual technology is just a flash memory, access to the data has the same cost no matter what you access and no matter what the access pattern).

 

4.      An experiment.  On your PC or a department computer, using C or C++, write a program that outputs characters into a file (using the file “create” and “write” system calls).  Write an n MB file in chunks of various sizes, starting with a single byte and then doubling the “chunk size” repeatedly until it reaches 32KB (2^10).  Run your program and time it.  Convert these times into an I/O “rate” (bytes/second) and graph the results for a few values of n:  1, 5, 10 and 20. 

 

 

Your experiment will result in a graph with several curves, one for each value of n, and with 10 data points on each.  How do you explain the shapes of these curves?  Why aren’t the curves flat lines?