Last Updated : 19 Nov, 2018

In a computer system, four files of size 11050 bytes, 4990 bytes, 5170 bytes and 12640 bytes need to be stored. For storing these files on disk, we can use either 100 byte disk blocks or 200 byte disk blocks (but can\’t mix block sizes). For each block used to store a file, 4 bytes of bookkeeping information also needs to be stored on the disk. Thus, the total space used to store a file is the sum of the space taken to store the file and the space taken to store the book keeping information for the blocks allocated for storing the file. A disk block can store either bookkeeping information for a file or data from a file, but not both.
What is the total space required for storing the files using 100 byte disk blocks and 200 byte disk blocks respectively?
(A) 35400 and 35800 bytes
(B) 35800 and 35400 bytes
(C) 35600 and 35400 bytes
(D) 35400 and 35600 bytes


Answer: (C)

Explanation:
Using 100 bytes disk blocks :

1. File of size 11050 bytes
Blocks required to store data = 11050/100 = 111
Blocks required for bookkeeping = (111 * 4)/100 = 5
Total blocks = 111 + 5 = 116

2. File of size 4990 bytes
Blocks required to store data = 4990/100 = 50
Blocks required for bookkeeping = (50 * 4)/100 = 2
Total blocks = 50 + 2 = 52

3. File of size 5170 bytes
Blocks required to store data = 5170/100 = 52
Blocks required for bookkeeping = (52 * 4)/100 = 3
Total blocks = 52 + 3 = 55

4. File of size 12640 bytes
Blocks required to store data = 12640/100 = 127
Blocks required for bookkeeping = (127 * 4)/100 = 6
Total blocks = 127 + 6 = 133

Total space required for storing the files using 100 byte disk blocks = (116 + 52 + 55 + 133) * 100 = 35600 bytes

 
Using 200 bytes disk blocks :

1. File of size 11050 bytes
Blocks required to store data = 11050/200 = 56
Blocks required for bookkeeping = (56 * 4)/200 = 2
Total blocks = 56 + 2 = 58

2. File of size 4990 bytes
Blocks required to store data = 4990/200 = 25
Blocks required for bookkeeping = (25 * 4)/200 = 1
Total blocks = 25 + 1 = 26

3. File of size 5170 bytes
Blocks required to store data = 5170/200 = 26
Blocks required for bookkeeping = (26 * 4)/200 = 1
Total blocks = 26 + 1 = 27

4. File of size 12640 bytes
Blocks required to store data = 12640/200 = 64
Blocks required for bookkeeping = (64 * 4)/200 = 2
Total blocks = 64 + 2 = 66

Total space required for storing the files using 100 byte disk blocks = (58 + 26 + 27 + 66) * 200 = 35400 bytes

 
Thus, option (C) is correct.

 
Please comment below if you find anything wrong in the above post.


Quiz of this Question


Share your thoughts in the comments