You are on page 1of 4

LUMS School of Science and Engineering

Department of Computer Science


Mid II Spring 2015
CS 570 Advanced Operating Systems

Roll no:

Instructions.
DO NOT FLIP OVER UNTIL TOLD TO DO SO. PENS DOWN WHEN TOLD TO DO SO.
Maximum time is 75 minutes and maximum possible score is 20 points.
Be brief and to the point. Argue why your answer is correct.
It is an open book, open notes exam but strictly no sharing of any material, even pens.
No electronic devices of any kind are allowed. Placing them under the seat is fine.
If there is any confusion, write down your assumptions and proceed to answer the question.
Write below if you run out of space for any question.

1. On a typical file system without journaling, crashes can lead to problems with the file system if they
come at inopportune times. Describe a sequence of events that would lead to:

3 pts

(a) Data loss (but no file system inconsistency)

(b) Metadata inconsistency

(c) Garbage data in a file

2. In log-structured file systems, if a segment was written a minute ago and another one ten minutes
ago and they both become half free, is it better to use one over the other for cleaning. Whatever
your answer is, explain why the authors chose to do it that way.

3. In Featherstich, why is it important to store a patch as a soft patch when there is an incoming
dependency on another patch in the block. What happens when there is no real block-level cycle.
What happens if there is an incoming dependency on the same patch. Can it also cause a block-level
cycle.

2 pts

2 pts

4. Give a small example of code that works faster with external synchrony if its output is redirected
to a file. How would this code behave in ext4 journaling file system. Will it finish writing to disk
faster or slower than external synchrony. Will it finish displaying the output faster or slower.

5. For the following three scenarios, explain how LFS, ext4 Journaling, Featherstich, and External
Synchrony try to ensure file system integrity:
(a) A file is modified and its modification time updated (no new blocks)

(b) Data is appended to a file (one new block was required)

(c) A file is moved from one directory to another

3 pts

6 pts

6. Write code for vac and unvac given the following prototypes. You can assume the following functions
and other simple helper functions. Write in any language you like. No pseudocode. Block size is 200
bytes. Think recursively.

4 pts

string writeBlock(string data200b); // write up to 200 bytes of data and return the hash
string[] splitBlocks(string fileData); // splits filedata into 200 byte blocks
string readBlock(string hash, int length); // read up to 200 bytes of data
(a) Return the final hash.
string vac(string fileData, int length)

(b) Returns filedata given root hash and file size.


string unvac(string rootHash, int length)

You might also like