0% found this document useful (0 votes)
27 views6 pages

L27-Tutorial File Management

The document discusses file allocation strategies in a file management system, focusing on contiguous, linked, and indexed allocation methods. It poses questions regarding logical-to-physical address mapping and the number of disk I/O operations required for various scenarios involving file modifications. Additionally, it explores indexed allocation using i-nodes, detailing the structure of index blocks and calculating maximum file sizes based on different allocation configurations.

Uploaded by

deepit2005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views6 pages

L27-Tutorial File Management

The document discusses file allocation strategies in a file management system, focusing on contiguous, linked, and indexed allocation methods. It poses questions regarding logical-to-physical address mapping and the number of disk I/O operations required for various scenarios involving file modifications. Additionally, it explores indexed allocation using i-nodes, detailing the structure of index blocks and calculating maximum file sizes based on different allocation configurations.

Uploaded by

deepit2005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

TUTORIAL IN FILE MANGEMENT

File Allocation Strategies


Q1. 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:

a. How is the logical-to-physical address mapping accomplished in this


system? (For the indexed allocation, assume that a file is always less than
512 blocks long.)

b. If we are 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?
File Allocation Strategies
◦ Q2: Consider a file currently consisting of 100 blocks. Assume that the file control block (and the index
block, in the case of indexed allocation) is already in memory. Calculate how many disk I/O operations are
required for contiguous, linked, and indexed (single-level) allocation strategies, if, for one block, the
following conditions hold. In the contiguous-allocation case, assume that there is no room to grow at the
beginning but there is room to grow at the end. Also assume that the block information to be added is stored
in memory.

a. The block is added at the beginning. b. The block is added in the middle.

b. The block is added at the end. d. The block is removed from the beginning.

e. The block is removed from the middle. f. The block is removed from the end.
File Allocation using i-node
Q3: Consider a file management system that uses indexed allocation scheme on a hard disk with a 256B per blocks
storage capacity. The blocks can be classified either as index blocks or data blocks. Every file is assigned a primary index
block similar to the inode structure in Unix file system. The data block does not contain any header/ control information and
the entire 256B can be used for data storage. Each primary index block contains a 32B header entry and 28 block index
entries each of which is 8B. Each such block index entry carries the address of another block which can be either another
index block or a data block. Out of the 28 block index entries, first 25 of them are pointing to data blocks directly and the
remaining three are single indirect, double indirect and triple indirect index blocks like the one used in Unix inode. The 28
block index entries of a single indirect block are all pointing to data blocks, where as the 28 block index entries of a double
indirect block are all pointing to addresses of another set of single indirect index block. Similarly the triple indirect index
block can also be defined with 3 levels of indirection. Block mapping for a file is done by fully completing each lower level
(entry 1-25) before going to next level of indirection (entry 26,27 and 28).
File Allocation using i-node
256B per data block a. What is the maximum size of a file that
can be mapped only with direct 25 data
blocks of the primary index block (single,
double and triple indirect entry is null)?

b. A file was assigned a valid entry in the


single indirect entry of its primary index
block and 20 out of 28 entries of that
single indirect index block were valid.
What can be the maximum size of the
file?

c. What is max file size possible?


Thank You

You might also like