6,435 views

In a particular Unix OS, each data block is of size $1024$ bytes, each node has $10$ direct data block addresses and three additional addresses: one for single indirect block, one for double indirect block and one for triple indirect block. Also, each block can contain addresses for $128$ blocks. Which one of the following is approximately the maximum size of a file in the file system?

1. $512$ MB
2. $2$ GB
3. $8$ GB
4. $16$ GB

### 1 comment

$Ans:B$

1.Maximum file size 2.Total size of file system 3.maximum possible file size $\left(2^{7}\right)^3 \times 2^{10}=2^{31}=2GB$

Maximum file size $= 10 \times 1024$ Bytes $+ 1 \times 128 \times 1024$ Bytes $+ 1\times 128\times 128 \times 1024$ Bytes $+ 1 \times 128 \times 128 \times 128 \times 1024$ Bytes $=$ approx $2 \ GB$.

@Gupta731

U can do that one with the same way..

Each block can contain 128 addresses
where in the other question size of a block is 128B and size of a add. is 8B so no. of addresses in one block are 128/8.
we have a number of blocks = DB Size / DBA =128, in question they have mentioned that

Which one of the following is approximately the maximum size of a file in the file system

(128)^3 * 2^10

(2)^31

2GB

### Size of File/Levels

Level-0 10*1024 B           1             1               1
Level -1   1*128*1024 B 1*128*1024 B 1*128*1024 B
Level- 2     1*128*128*1024 B     1*128*128*1024 B
Level -3       1*128*128*128*1024 B

Add the Principle Diagonal Values = 2.01575 GB = Approx. 2.0 GB

why multiplied by 1 in indirect address (though it will not effect the result but just curious about it )
it indicates file has 1 indirect address

maximum file size=(10+x+x2+x3)*Blocksize

x=no of block addresses in a block=27

maximum file size=(10+x+x2+x3)*210 B = (10+27+214+221)*210  = 231B = 2GB

Maximum size of the File System = Summation of size of all the data blocks whose addresses belongs to the node.

Given:
Size of 1 data block = 1024 Bytes
No. of addresses which 1 data block can contain = 128 (just like 128 page table entry stored in a block)

Now, Maximum File Size can be calculated as:
10 direct addresses will point to 10 data blocks in the memory = 10*1024
1 single indirect entry will point to 1 block which again  points to 128 data block in the memory (just like multi level paging) = 128*1024
1 doubly indirect entry will point to 128*128 data block = 128*128*1024
1 triple indirect entry will point to 128*128*128 data block = 128*128*128*1024

Hence,
Max File Size = 10*1024 + 128*1024 + 128*128*1024 +
128*128*128*1024 Bytes
= 2113674*1024 Bytes
= 2.0157 GB ~ 2GB