COS 318: Operating Systems, Fall 2013

Quiz 6: Storage and File Systems

Due: 11:55pm, Wednesday, December 11

This quiz checks your understanding of the lectures and reading assignments during the past two weeks. You may reference the textbook, lecture slides, and your notes. Online sites (e.g., Wikipedia) may also be consulted but you must cite them in your writeup. Please strive for clarity and brevity in your answers.

Submit your answers by clicking the "submit" link on the lecture schedule page. Only online submissions will be accepted. Please use this template when preparing your answers, and submit a plain ASCII text file.

Questions:

  1. RAID (4 points). Suppose a RAID4 system has a total of 5 disks. Describe how it works using no more than 1-4 bullets for each of the questions below.

    1. How does RAID4 use these 5 disks?
    2. What does RAID4 do when it writes data chunk D?
    3. What does RAID4 do when it reads data chunk D?
    4. What does RAID4 do when a disk (either data disk or parity disk) fails?
  2. Transactions (2 points). In the lecture, we showed how to implement a transaction example with a write- ahead log:

    	  BeginTransaction
    	  S = S - $100;
    	  C = C + $100; 
    	  Commit
    	

    We showed that before transaction, S = $800 and C = $10. The log has three things: {S = $700} {C = $110} {Commit}. Is it possible to replace them with {S = S - $100} {C = C + $100} {Commit}? Please explain why or why not, using no more than two sentences.

  3. Journaling File System (3 points). We discussed in class that “Journaling File System” uses a transaction mechanism to implement file system updates. Suppose we append a data block to a file. This operation may require update three on-storage data structures: i- node (a new pointer to the data block, file size, modified time, etc), bitmap (block allocation), and the data block itself. A journaling file system writes the following to the write-ahead log:

    	{updated i-node block}{updated bitmap block}{data block}{Commit}
          

    Suppose that each of above needs a block. We will need to write 4 blocks to disk storage. But, we do not have control over exactly how the disk blocks of the log are allocated on disk and what disk-scheduling algorithm is used in the storage layer. In this case, it is not safe to combine the writing of the 4 blocks into one large logical write operation to the log.

    1. Explain why this is not safe by a simple example.
    2. Since a disk drive can raise an interrupt after a write operation to disk completes (completion of a DMA operation), can you use such mechanism to combine the writing of the 4 blocks into one large logical write operation? If the answer is yes, please elaborate how you do it.
    3. Suppose you want to design a journal file system that logs only metadata updates in the write-ahead log and write the data block to file system proper directly. You have two design choices: write the data block after executing the transaction for updating i-node and bitmap or write the data block before the execution of the transaction. Are these design choices safe? Explain why or why not.