in Operating System retagged by
22,709 views
18 votes
18 votes
The index node (inode) of a Unix -like file system has $12$ direct, one single-indirect and one double-indirect pointers. The disk block size is $4$ kB, and the disk block address is $32$-bits long. The maximum possible file size is (rounded off to $1$ decimal place) ____ GB
in Operating System retagged by
by
22.7k views

4 Comments

I've got a doubt, please everyone take a look and tell me if I'm wrong:

In the question the disk block size is explicitly mentioned as 4 kB, not 4KB, and 

kB means 1000 Bytes whereas KB means 1024 Bytes 

(Now I know in these confusions in CN, we always take 1024 for data and 1000 for BW, but that's just a convention, right?) whereas the notations are defined in standards, I'm attaching the wiki page link for proof :

 

https://en.wikipedia.org/wiki/Kilobyte

(In this wiki page please read definitions and usage for examples first before answering)

@Shaik Masthan @Arjun @Ashwani Kumar 2

0
0

In the question the disk block size is explicitly mentioned as 4 kB, not 4KB, and 

kB means 1000 Bytes whereas KB means 1024 Bytes 

it's depend upon what is the base you are taking is it 2 or 10, but as per me, we have to take 1024 but not 1000.

but hope GATE key have range of values ! 

1
1

$(2^{10})^2*2^{12}B$

=> $2^{32}B$

=> $4$ GB

https://gateoverflow.in/1045/gate2004-49?show=330294#a330294

2
2

4 Answers

37 votes
37 votes
Best answer
Given $12$ direct, $1$ single indirect, $1$ double indirect pointers

Size of Disk block $= 4kB$

Disk Block Address $= 32 \text{ bit } = 4B$

Number of addresses= Size of disk block/address size $= \frac{4kB}{4B} = 2^{10}$

Maximum possible file size$ = 12*4kB\  + \ 2^{10} * 4kB \ + \ 2^{10} * 2^{10} * 4kB$

$= 4.00395 \  GB \simeq 4 \ GB$

Hence $4GB$ is the correct answer
edited by

4 Comments

should we consider only the most significant term or the addition of all terms, because in some palces they only consider the most significant term...
0
0

Please refer “The Design of the UNIX Operating System” by Maurice J. Bach

0
0
here we can consider most significant term because if we add the terms then they can change only maximum of 4-5 digits places  and our significant term has 7 digits and they want answer upto 1 decimal place . so , we can consider :)
0
0
12 votes
12 votes
Disk block size $= 4$ KB $= 2^{12}$ Bytes

Disk block address $= 32$ bits $= 4$ Bytes $= 2^2$ Bytes

No of addresses in a block $= 2^{12}/ 2^2 = 2^{10}$

Maximum file size $= (20 + 2^{10} + (2^{10})^2)* 2^{12} = X$

$= X / 2^{30}$ GB

$= 4.0$ GB
edited by

1 comment

Maximum file size =(20+210+(210)2)∗212=X

Here why 20 is added, why not 12 added?

1
1
4 votes
4 votes
1GB = $2^{30}B$

DB = Disk Block

DBA length or size = 32 bits

= 4 B

#DBAs that can be stored per DB = DB size/ DBA size

= $\frac{2^{12}}{2^2}$

= $2^{10}$

TOTAL file size

= $(\#DirectPtr + \sum_i(\#Ptr_i * \#DBAs)^{i} )  * DB size$

Where i = indirectionLevel (single = 1, double = 2, etc)

Each direct pointer points to a single DB and for indirect pointer it depends on the indirectionLevel (single, double, triple or etc) to point to that many DBs. Thus we get max file size by multiplying total DB pointers with DBsize.

= $(12 + \sum (1*2^{10})^1 \ + (1*2^{10})^2 )*2^{12}\ B$

=$4. 004\ GB$ or

= 4.0(ANS)
edited by

1 comment

Can anyone elaborate how the calculation is done at the end ?
0
0
1 vote
1 vote
Simple calculation –  

= 4GB+ 4MB + 48KB

To convert everything into GB we have to multiply by 1/1GB which is (1 / 1024*1024*1024) B

So, 4MB = 4 * 1024 * 1024 B and now into 4 *1024 * 1024 / 1024 * 1024 * 1024

4MB = (4 / 1024) GB = 0.00390625 GB

48 KB = 48 * 1024 / 1024 * 1024 * 1024 = 48 / 1024 * 1024 = 0.0000457763671875 GB

Maximum possible file size = 4GB + 0.00390625 GB +

0.0000457763671875 GB

= 4.00395 GB ≃4 GB
Answer:

Related questions