You are on page 1of 3

4/26/12

CS 450 Assignment 5 solutions

Assignment5solutions
I. DISK HEAD SCHEDULING Consider the following table of block requests and arrival times: Block # Arrival time 50 30 80 25 100 120 75 0 50 100 130 180 220 250

15 300 The disk head is initially positioned over block 0. Seeking across n blocks requires 20+2n ms, and access times can be ignored. Assume that once a block has been scheduled, subsequent arrivals (even intervening ones) will not be considered until the scheduled block has been serviced. For each of the following disk head scheduling algorithms, list the order in which block requests are serviced, and the resulting seek times. 1. SSTF 50 ; 20 + 2(50) = 120 30 ; 20 + 2(20) = 60 25 ; 20 + 2(5) = 30 80 ; 20 + 2(55) = 130 75 ; 20 + 2(5) = 30 100 ; 20 + 2(25) = 70 120 ; 20 + 2(20) = 60 15 ; 20 + 2(105) = 230 Total = 730 2. LOOK 50 ; 20 + 2(50) = 120 80 ; 20 + 2(30) = 80 100 ; 20 + 2(20) = 60 120 ; 20 + 2(20) = 60 75 ; 20 + 2(45) = 110 30 ; 20 + 2(45) = 110 25 ; 20 + 2(5) = 30 15 ; 20 + 2(10) = 40
cs.iit.edu/~lee/cs450/assignments/fs-sols.html 1/3

4/26/12

CS 450 Assignment 5 solutions

Total = 610 II. FAT FILESYSTEMS Consider the following parameters of a FAT based filesystem: Blocks are 1KB (1024) bytes large FAT entries are 32 bits wide, of which 24 bits are used to hold a block number Two copies of the FAT are maintained on disk at all times, for redundancy 1. What is the largest disk size supported by this filesystem? Size of block = 1KB Total # of blocks = 224 bits = 16M So ... largest disk size = 16M x 1KB = 16GB 2. For a 128MB disk, how much space must be set aside to hold the FAT structures? 128MB = 27 x 220 bytes, or 217 blocks Each block requires a 32-bit (4 byte) entry in the FAT, so the FAT is 217 x 4 = 219 bytes (512KB) large. Since there are two copies of the FAT, 1MB needs to be set aside for them. III. I-NODE FILESYSTEMS Consider the following parameters of an i-node based filesystem: Blocks are 1KB (1024 bytes) large Block pointers are 64-bits (8 bytes) wide Each i-node contains 10 direct pointers, 2 single indirect pointers, 2 double indirect pointers, and 1 triple indirect pointer 1. What is the largest file size supported by this filesystem? First, a block (1KB) can contain 1024/8 = 128 (27) pointers So an i-node can ultimately refer to: 10 1KB blocks 2 blocks of 128 pointers to 1KB blocks = 256KB 2 blocks of 128 x 128 pointers to 1KB blocks = 32MB 1 block of 128 x 128 x 128 pointers to 1KB blocks = 2GB The sum of the above is the max file size supported by the filesystem 2. After opening a file that is approximately 10MB in size and loading its i-node into memory, a system call is issued to skip to the middle of the file. Describe the resulting sequence of block requests that must be carried out.
cs.iit.edu/~lee/cs450/assignments/fs-sols.html 2/3

4/26/12

CS 450 Assignment 5 solutions

A 10MB file can be entirely described using just double-indirect file pointers. Assuming the file's inode is already in memory, 1 request must be issued to read the double indirect block 1 request must be issued to read the appropriate single indirect block 1 request must be issued to read the appropriate data block IV. JOURNALING The file deletion operation in UNIX can be accomplished in the following three steps: Remove the file entry from the containing directory Mark the file i-node as being free Mark the file data blocks as being free If we were to implement a system of soft updates such that, in the event of a system crash in the middle of a file deletion the worst that could happen was "leaked" disk space, what order would we perform the above operations in? 1. Remove the file entry from the directory (if we crash after this, the entire file is leaked) 2. Mark the i-node as being free (if we crash after this, we can reuse the i-node, but the data blocks are leaked) 3. Mark the file data blocks as being free Now consider a filesystem with journaling support. Upon reboot following a crash, the following uncommitted transaction entry is discovered in the journal:
< t r a n s a c t i o n > < d e l/ h o m e / l e e / f o o > < f r e e3 1 9 > < f r e e1 2 0 1 9 > < / t r a n s a c t i o n >

What action should be taken to ensure the filesystem is consistent? Check to see if all the steps have been carried out. If not, do them. In a separate reboot following a crash, the following incomplete transaction is discovered in the journal:
< t r a n s a c t i o n > < d e l/ h o m e / l e e / b a r > < f r e e4 0

What action should be taken to ensure the filesystem is consistent? Delete the (incomplete) journal entry.

cs.iit.edu/~lee/cs450/assignments/fs-sols.html

3/3

You might also like