5.7k views

Consider a hard disk with $16$ recording surfaces $(0-15)$ having 16384 cylinders $(0-16383)$ and each cylinder contains $64$ sectors $(0-63)$. Data storage capacity in each sector is $512$ bytes. Data are organized cylinder-wise and the addressing format is <cylinder no., surface no., sector no.> . A file of size $42797$ KB is stored in the disk and the starting disk location of the file is $<1200, 9, 40>$. What is the cylinder number of the last sector of the file, if it is stored in a contiguous manner?

1. $1281$
2. $1282$
3. $1283$
4. $1284$
edited | 5.7k views
0
< cylinder no , surface no ,sector no> -> address format ?
0
Yes.. Thanks..  corrected now :)
+9

each cylinder contains 64 sectors $\implies$ at each surface within the cylinder there are 64 sectors

0
@amarVashishth what do you mean by that comment, are we supposed to interpret that statement like that? If yes, then why?
+2
try both ways and check :
1) 1 cylinder contains 64 sectors this means that all surface combined there are just 64 sectors.
2) at each surface within the cylinder there will be 64 sectors so in a cylinder there will be a total of $16\times 64$ sectors
0

Sector number starts from 0. Why it would not be sector 0 and sector 1? <1284,3,1>

okk. Understood the concept from https://gateoverflow.in/1337/gate2009-51

0
i am having the same doubt. what did you understand??
+1
Why are we taking "each cylinder contain 64 sectors"  as 64*16? Is it taking cylinder same as track?
+2
i think question has got misinterpretation
according to me , it says
16 surfaces , 16384 cylinders/surface , 64 sectors/cylinders
+2
one cylinder has is a surface which covers the same track on all the surfaces and hence the question is wrong it should be given that each surface has 64 sectors
0
How to understand data unit 42797 KB means 42797 *2^10 will give 1284 and if I use 42797 *10^3 for KB I get answer 1282!! How to interpret which data unit to use when!!:(

First convert $\langle 1200,9,40\rangle$ into sector address.

$(1200 \times \mathbf{16 \times 64}) + ( 9 \times \mathbf{64}) + 40 = 1229416$

Number of sectors to store file $= (42797 \ KB) / 512 = 85594$

Last sector to store file $= 1229416+85594=1315010$

Now, do reverse engineering,

$1315010/(\mathbf{16 \times 64})=1284.189453$ $(1284$ will be cylinder number and remaining sectors $=194)$

$194/\mathbf{64} = 3.03125$  $(3$ is surface number and remaining sectors are $2)$

$\therefore \langle 1284,3,1\rangle$ is last sector address.
edited by
+13

In these types of questions we have to use "CHS to LBA mapping".
Given address is in CHS format then we first convert it into LBA, then after adding file size we have to convert back into CHS.

0

Thanks Sachin for sharing this useful link.

Now come to the calculation. For example as per above calculation <0,0,40> will become LBA 40. means LBA also starts from 0. So, when reversing LBA to CHS no need to subtract 1 at the last step of sector address calculation.That would result LBA 40 to become <0,0,39> which is incorrect. So, correct CHS of this answer would be <1284,3,2>

+1

last sector to store file = 1229416+85594=1315010

I think there we need to subtract 1

last sector to store file = 1229416+85594-1=1315009

Even if you do reverse map,the final answer will give:-

(1284 * 16 * 64) + ( 3 * 64) + 1 = 1315009

0
@rahul. Can you tell me what is starting LBA here? is it 1 or 0?

i.e. CHS <0,0,0> will be LBA 0 or LBA 1?

0
Thanks best explained
0

@All

(1200 '* 16 * 64) + ( 9 * 64) + 40 = 1229416

+1
Why only sector no. Of last sector address is subtracted by 1? Even cylinder no. & Surface no. are also starting from 0 right?
0
Its (0,0,0)
0
here each cyllinder contains 16 sectors  and each surface contain 16384 cyllinder then how you write this line---

(1200×16×64)+(9×64)+40=1229416
0
Is there any book which contains similar question like this one, and explains the topic
$42797\; KB = 42797 \times 1024$ bytes require $42797 \times 1024 / 512$ sectors $= 85594$ sectors.

$\langle 1200, 9, 40 \rangle$ is the starting address. So, we can have $24$ sectors in this recording surface. Remaining $85570$ sectors.

$85570$ sectors require $\lceil \frac{85570}{64}\rceil= 1338$ recording surfaces. We start with recording surface $9,$ so we can have $7$ more in the given cylinder. So, we have $1338 - 7 = 1331$ recording surfaces left.

In a cylinder, we have $16$ recording surfaces. So, $1331$ recording surfaces require  $\lceil \frac{1331}{16}\rceil = 84$ different cylinders.

The first cylinder (after the current one) starts at $1201.$ So, the last one should be $1284.$

$\langle 1284, 3, 1 \rangle$ will be the end address. $(1331 - 16 \times 83 +1 - 1 = 3$ $(3$ surfaces full and $1$ partial and $-1$ since address starts from $0),$ and $85570 - 1337 \times 64 -1 = 1)$
+1

@arjun sir:

so we can have 7 more in the given cylinder. So, we have 1338 - 7 = 1331 recording surfaces left.

numbering start from 0 nd it goes till 15(Surface No.).

so we can have 6 more cylinder instead of 7. Correct me!!!!

0
why the sector no in the last address not 1 since only 2 sectors are remaining- 0,1?
0
0
@arjun sir, update is needed in answer, surface 9 already used by 24 sectors so secotrs from 10-15 , i.e. 6 remain still answer will remain
0
sir can we also do like this....

GIVEN  we have 16 recording surfaces  16384 cylinders  and each cylinder contains 64 sectors  so we can <16384, 16,64> and  starting address < 1200,9, 40>

Supoose we have x cylinder  & in each cylinder we have 16 surface and 64 cylinder so we need to store 42797 KB of data

X * 16* 64 *512 + 16*64* 512 + 64* 512 = 42797 KB        , X= 82.5 so we need almost 83 cylinders

we can add this in starting address but we <1200, 9 ,40 >  so we need so to cover 9 more surface and 40 sectors which is equivalent to one more cylinders data....

so 1200+83+1 so currently we on 1284 cylinder.
+1
@Arjun Sir, It should be <1284,3,1>, address of last byte since sector number also starts from 0. In 1284 cyliner, 194 sectors will be used. 3 surfaces (numbered from 0 to 2) in total will contain 192 sectors (3*64). After that 2 sectors are let which will be numbered 0 and 1 in 4th surface (numbered as 3). Please correct if I am wrong
0
@Anchit Exactly, I have corrected.
0

Cleared the doubt as well as concept
+2

Arjun Sir,  I think "each cylinder contains 64 sectors (0-63)" this statement given in the question is wrong, it should have been like "each surface contains 64 sectors (0-63)". Please clear my doubt.

• 16 Surfaces(0-15)
• 16384 cylinders (0-16383)
• Each cylinder has 64 sectors (0-63)
• Sector Capacity=512 Byte
• File Size =42797KB
• Number of sectors required by file = $\frac{42797*1024(Bytes)}{512}= 85594$
• #Sectors per cylinder = 16*64 = 1024
• Starting disk location of file = <1200,9,40>
• Remaining sectors to be filled till next cylinder 1201 will be
(63-40+1)(Head number 9(means surface 10th) is completely filled + (15-10+1)*64 = 408
• Remaining sectors to be allocated to file  = 85594-408=85186
• These 85186 sectors will take  = $\left \lceil \frac{85186}{1024} \right \rceil = 84$ cylinders
• Means inclusive of 1201, we need to add 83 more cylinders, so answer= 1201+83=1284 Cylinder number
0
from whre should i learn these concepts to solve these question??
0
@Shubham-just know how data is written into hard disk, when it comes in terms of platters, cylinders and tracks
0
Ok sir
+1

@Ayush can you please help me where am I going wrong? :( Sorry fot the horizontal image. Please tell me how to rotate it. I din't find any option.

0
@tusharp-After filling 10th surface completely(s=9), remaining surface numbers are 10,11,12,13,14,15-> 6 of them with 64 sector each.

So, sectors remaining to fill cylinder 1200->24+6*64 and you did 24+7*64
0
Use CHS to LBA Mapping formula and you'll get answer fast

Cylinder no 1284

+1 vote

1