Question

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.⟩\langle \text{cylinder no., surface no., sector no.} \rangle. A file of size 42797 KB is stored in the disk and the starting disk location of the file is ⟨1200,9,40⟩\langle 1200, 9, 40 \rangle. What is the cylinder number of the last sector of the file, if it is stored in a contiguous manner?

Choose one option
Official answer and solution
Official answer
D
From
Official GATE 2013 answer key

Solution

Compute the total number of sectors required for the file and add to the starting linear sector index, taking into account the disk geometry.

Let us analyze the disk parameters:

  • Number of surfaces = 16 (numbered 0 to 15).
  • Number of cylinders = 16384 (numbered 0 to 16383).
  • Number of sectors per track on each surface = 64 (numbered 0 to 63).
  • Therefore, number of sectors per cylinder =16×64=1024= 16 \times 64 = 1024 sectors.
  • Capacity per sector = 512 bytes =0.5= 0.5 KB.

Now calculate the file size in sectors:

File size=42797 KB=42797×1024 bytes\text{File size} = 42797\text{ KB} = 42797 \times 1024\text{ bytes}
Total sectors needed=42797×1024 bytes512 bytes/sector=42797×2=85594 sectors\text{Total sectors needed} = \dfrac{42797 \times 1024\text{ bytes}}{512\text{ bytes/sector}} = 42797 \times 2 = 85594\text{ sectors}

Next, determine the linear sector index of the starting position ⟨1200,9,40⟩\langle 1200, 9, 40 \rangle:

  • The cylinder number is 1200.
  • Preceding cylinders (0 to 1199) contribute: 1200×1024=12288001200 \times 1024 = 1228800 sectors.
  • Within cylinder 1200, surface 9 sector 40 is at relative sector offset: 9×64+40=576+40=6169 \times 64 + 40 = 576 + 40 = 616.
  • Thus, starting linear sector index =1228800+616=1229416= 1228800 + 616 = 1229416.

The file spans 85594 contiguous sectors. The linear index of the last sector of the file is:

Last sector index=1229416+85594−1=1315009\text{Last sector index} = 1229416 + 85594 - 1 = 1315009

Now, find the cylinder number of this last sector by dividing by the number of sectors per cylinder (1024):

Cylinder number=⌊13150091024⌋=⌊1284.1885⌋=1284\text{Cylinder number} = \left\lfloor \dfrac{1315009}{1024} \right\rfloor = \lfloor 1284.1885 \rfloor = 1284

Therefore, the last sector of the file lies in cylinder 1284.

Final answer

D

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2013 Computer Science and Information Technology (CS)
Question
29 of 65, printed as CS Q.29
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.