Question wrote:A UNIX file system has 1-KB blocks and 4-byte disk address. What is the maximum file size if i-nodes contain 10 direct entries, and one single, double and triple indirect entry each?
block = 2^10
block pointer size = 4B
entries possible in block = 2^10 / 2^2 = 256
direct pointer gives = 10 * 256 = 10 blocks
single indirect gives = 256 * 256 = 2^8 blocks
double indirect gives = 256 * 256 * 256 = 2^16 blocks
triple indirect gives = 256 * 256 * 256 * 256 = 2^14 blocks
total = 16777546 blocks = 16777546 * 1024 = 17180207104 ~ 16 GB
Question wrote:In a particular UNIX OS, each data block is of size 1024 bytes,each node has 10 direct data block address and three additional addresses:one for single indirect address,one for double indirect block,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.
block = 2^10
block pointer size = 1024/128 = 8
entries possible in block = 2^10 / 2^3 = 128
direct pointer gives = 10 * 128 = 10 blocks
single indirect gives = 128 * 128 = 2^7 blocks
double indirect gives = 128 * 128 * 128 = 2^14 blocks
triple indirect gives = 128 * 128 * 128 * 128= 2^21 blocks
total = 16777546 blocks = 16777546 * 1024 = 17180207104 ~ 16 GB
total = 2113674 blocks = 2113674 * 1024 ~ 2GB
Check this out!!! Free Android App for Computer Science and Engineering Exam.
Download .apk file @ tinyurl.com/csexamapp
See How To Use @ tinyurl.com/csexamapplication