Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. For the Problem Do only part b; however, use the assumptions from part a: Con

ID: 3768134 • Letter: 1

Question

1. For the Problem Do only part b; however, use the assumptions from part a: Consider a file system on a disk that has both logical and physical block sizes of 512 bytes. Assume that the information about each file is already in memory. For each of the three allocation strategies (contiguous, linked and indexed), answer these questions:

Do not answer just use the Assumptions from it: 1. a.) How is the logical-to physical address mapping accomplished in this system? (For indexed allocation, assume that a file is always less than 512 blocks long.)

Answer this one useint the assumptions of part a: 1. b.) If we currently at logical block 10( the last block accessed was block 10) and want to access logical block 4, how many physical blocks must be read from the disk.

2. In Answering the question also Explain how to relocate files and give one reason why one would want to avoid file compaction/relocation: Fragmentation on a storage device can be elimated by recompaction of the information. Typical disk devices do not have relocation or base registers (such as those used when memory is to be compacted), so how can we relocate files? Give three reasons why recompacting and relocation of files are often avoided.

Explanation / Answer

1)

Let Z be the starting file address (block number).
a. Contiguous. Divide the logical address by 512 with X and Y the resulting quotient and remainder respectively.
i. Add X to Z to obtain the physical block number. Y is the displacement into that block.
ii. 1
b. Linked. Divide the logical physical address by 511 with X and Y the resulting quo-tient and remainder respectively.
i. Chase down the linked list (getting X + 1 blocks). Y + 1 is the displacement into the last physical block.
ii. 4
c.Indexed. Divide the logical address by 512 with X and Y the resulting quotient and remainder respectively.
i. Get the index block into memory. Physical block address is contained in the index block at location X. Y is the displacement into the desired physical block.
ii. 2


2)

Relocation of files on secondary storage involves considerable overhead. Data blocks have to be read into main memory and written back out to their new locations. Furthermore, relocation registers apply only to sequential files, and many disk files are not sequential. For this same reason, many new files will not require contiguous disk space; even sequential files can be allocated noncontiguous blocks if links between logically sequential blocks are maintained by the disk system