# GATE2019-42

6 votes
6.1k views
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

edited
0
4GB
0
4.0
0

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)

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 !

0

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

=> $2^{32}B$

=> $4$ GB

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

## 3 Answers

10 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/disk block $= \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
0

I have put 4.0 @Shaik Masthan

1
no problem ! @jatin
0

@Shaik Masthan I entered value as 4.0039 will that be considered as correct ?

1
after one decimal point everything is invalid !

So, your answer look like as 4.0 only !
1
i don't know, but i hope 4.0=4 only !
0
i've answered 4.1 is it right??
0
Please tell any book or online resource to learn about this topic
0
i've answered 4.1

is that correct??
0

@Ashwani Kumar 2 Can you please elaborate the calculation. Actually, left this question in exam because I was stuck in the calculation part. I had solved the question in same manner but after (12∗4KB + 2^10∗4KB + 2^10∗2^10∗4KB) I was not sure how to calculate the answer.

0
From where can I read more about this concept and practice more problems
0
All those stuck in the calculation part convert 48 KB and  4 MB to GB then add with 4 GB you'll be getting the answer as 4.003951 GB ≃4 GB
1

Good Video

11 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
0
Maximum file size =(20+210+(210)2)∗212=X

Here why 20 is added, why not 12 added?

3 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
0
Can anyone elaborate how the calculation is done at the end ?
Answer:

## Related questions

12 votes
8 answers
1
5.7k views
The following C program is executed on a Unix/Linux system : #include<unistd.h> int main() { int i; for(i=0; i<10; i++) if(i%2 == 0) fork(); return 0; } The total number of child processes created is ________________ .
12 votes
6 answers
2
5.3k views
Consider three concurrent processes $P1$, $P2$ and $P3$ as shown below, which access a shared variable $D$ that has been initialized to $100$ ... the minimum and maximum possible values of $D$ after the three processes have completed execution are $X$ and $Y$ respectively, then the value of $Y-X$ is ____
13 votes
4 answers
3
5.6k views
Consider the following four processes with arrival times (in milliseconds) and their length of CPU bursts (in milliseconds) as shown below: ... Shortest Remaining Time First scheduling algorithm. If the average waiting time of the processes is $1$ millisecond, then the value of $Z$ is _____
4 votes
5 answers
4
3.7k views
Consider the following C program : #include<stdio.h> int jumble(int x, int y){ x = 2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n",x); return 0; } The value printed by the program is ______________.