896 views
2 votes
2 votes
In a computer system, three files of size 11052 B, 4992 B and 5172 B need to be stored. For storing these files on disk, we can use either 100 B disk block or 200 B disk block. For each block used to store a file, 2 bytes of book keeping information also needs to be stored on the disk. Thus, the total space used to store a file is the sum of space taken to store the file and space taken to store the book keeping information for the blocks allocated for storing the file. A disk block can store either book keeping information for a file or data from a file, but not both. What is the total space required for storing the files using 100 B and 200 B disk blocks respectively.

A 21800 B, 22240 B

B 21700 B, 22000 B

C 21900 B, 22000

D 21800 B, 22200 B

 

plz explain this question

1 Answer

2 votes
2 votes
  $100B$

$Bookkeeping$

$200B$ $Bookkeeping$
$file- $$11052 \ B$ $111$ $3$ $56$ $1$
$file- $$4992 \ B$ $50$ $1$ $25$ $1$
$file- $$5172 \ B$ $52$ $2$ $26$ $1$
  $213$ $6$ $107$ $3$
$\color{RED}{Total}$ $\color{blue}{219 \times 100=21900B}$ $\color{blue}{110 \times 200=22000B}$

Description :

  • The $2^{nd}$ column values are the no of blocks we need to store the repsective file .  
    • For example for $11052B=\frac{11052}{100} =110.52 =111Blocks $
  • The $3^{rd}$ column values are the no of blocks which is used for storing bookkeeping information about the file as mentioned in question we need $2B$ for every block the file is using .
    • For example for $111$ blocks bookkeeping =$111 \times 2=222 >200B \ \therefore$  need 3 blocks of $100B$ each.
  • Similarly subsequent calculation for $200B$ block.

Note :

I am not clubbing the book keeping information $i.e$ for $100B$ the calculation is not done like this : $111+50+52=213 \times 2 =426>400 \therefore$ $5$ blocks for bookkeeping .

But this is wrong way of keeping meta data about files because it may lead to inconsistency about data because there can be same information regarding two files.like the same concept we use for directories .

edited by

Related questions

1 votes
1 votes
1 answer
1
0 votes
0 votes
1 answer
4
jugnu1337 asked Dec 18, 2021
518 views
what is seek system call? can anyone explain?