Skip to content
Official PYQ · 2025

GATE CS 2025 Set 1 Q41 — File Systems

Explain with AI
A disk of size 512 M512 \text{ M} bytes is divided into blocks of 64 K64 \text{ K} bytes. A file is stored in the disk using linked allocation. In linked allocation, each data block reserves 44 bytes to store the pointer to the next data block. The link part of the last data block contains a NULL pointer (also of 44 bytes). Suppose a file of 1 M1 \text{ M} bytes needs to be stored in the disk. Assume, 1 K=2101 \mathrm{~K}=2^{10} and 1M=2201 \mathrm{M}=2^{20}. The amount of space in bytes that will be wasted due to internal fragmentation is __________. (Answer in integer)
View worked solution

Answer: 65468:65468

To find the space wasted due to internal fragmentation, we need to determine how the file is distributed across the disk blocks under the linked allocation scheme.

1. Given Parameters

  • Disk Block Size: 64 K=64×1024=65,536 bytes64 \text{ K} = 64 \times 1024 = 65,536 \text{ bytes}
  • Pointer Size: 4 bytes4 \text{ bytes}
  • Usable Data Space per Block: 65,536−4=65,532 bytes65,536 - 4 = 65,532 \text{ bytes}
  • File Size: 1 M=1,048,576 bytes1 \text{ M} = 1,048,576 \text{ bytes}

2. Number of Blocks Required

The number of blocks NN required to store the file is calculated as:

N=⌈File SizeUsable Data Space per Block⌉=⌈1,048,57665,532⌉=⌈16.00104⌉=17 blocksN = \left\lceil \frac{\text{File Size}}{\text{Usable Data Space per Block}} \right\rceil = \left\lceil \frac{1,048,576}{65,532} \right\rceil = \lceil 16.00104 \rceil = 17 \text{ blocks}

3. Distribution of File Data

  • The first 1616 blocks are completely filled with file data. Data stored in first 16 blocks=16×65,532=1,048,512 bytes\text{Data stored in first 16 blocks} = 16 \times 65,532 = 1,048,512 \text{ bytes}
  • The remaining file data is stored in the 17th17^{\text{th}} (last) block: Data in the last block=1,048,576−1,048,512=64 bytes\text{Data in the last block} = 1,048,576 - 1,048,512 = 64 \text{ bytes}

4. Internal Fragmentation

Internal fragmentation occurs in the last block because it is allocated but not fully utilized. The space used in the last block is for the 44-byte NULL pointer and the 6464 bytes of file data.

Wasted Space=Block Size−(Pointer Size+Data in Last Block)=65,536−(4+64)=65,536−68=65,468 bytes\begin{aligned} \text{Wasted Space} &= \text{Block Size} - (\text{Pointer Size} + \text{Data in Last Block}) \\ &= 65,536 - (4 + 64) \\ &= 65,536 - 68 \\ &= 65,468 \text{ bytes} \end{aligned}

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore File Systems questions