{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cop4600-sp08-hw3Solutions

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

Info icon This 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
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern