edited by
9,071 views
31 votes
31 votes

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
edited by

5 Answers

Best answer
38 votes
38 votes

Answer: (B)

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$.

edited by
14 votes
14 votes

Size of File/Levels      

Direct Address         

Indirect Address-1                

Indirect Address-2                

Indirect Address-3                     

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

7 votes
7 votes

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

 

3 votes
3 votes

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

Answer:

Related questions

28 votes
28 votes
4 answers
4