cop4600-sp08-hw3Solutions

cop4600-sp08-hw3Solutions - Homework 3 Solution 1.)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 3 Solution 1.) Contiguous file allocation approach : When append is done, there is no space for f3, so f3 has to be removed from its old location and put in the place where 6 contiguous blocks are available. Before Append : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 / d1 d4 f2 f2 f1 d2 f3 f3 f3 d5 f4 f4 f4 f4 d3 f5 f5 f5 f5 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 f5 f6 f6 f6 f6 f6 f6 After Append: blocks changed are shown in red 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 / d1 d4 f2 f2 f1 d2 d5 f4 f4 f4 f4 d3 f5 f5 f5 f5 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 f5 f6 f6 f6 f6 f6 f6 f3 f3 f3 f3 f3 f3 Since f3 lies under /d2 hence, 2 block are read to reach f3. Also, all the three blocks of f3 have to replaces and written to a new location. Hence, 3 more blocks are read to load file f3 in memory and write it back to a new location. Hence total blocks read = 3+2 = 5. For writing, all the six blocks have to be written to a new location. Also, the contents of directory d2 have to be changed too since location of file f3 under it has changed. Hence a total of 7 blocks are written. Linked list approach : We add the appended blocks in the empty list of blocks wherever they are available starting from the first empty block available. Before Append: Contents of the disk blocks: Just shown for file f3. Numbers inside the box represent the data in that physical block and the pointer to the next physical block
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 04/18/2008 for the course COP 4600 taught by Professor Yavuz-kahveci during the Spring '07 term at University of Florida.

Page1 / 4

cop4600-sp08-hw3Solutions - Homework 3 Solution 1.)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online