A disk of size 512M bytes is divided into blocks of 64K bytes. A file is…

2025

A disk of size 512M bytes is divided into blocks of 64K bytes. A file is stored in the disk using linked allocation. In linked allocation, each data block reserves 4 bytes to store the pointer to the next data block. The link part of the last data block contains a NULL pointer (also of 4 bytes). Suppose a file of 1M bytes needs to be stored in the disk. Assume, 1K = 210 and 1M = 220 . The amount of space in bytes that will be wasted due to internal fragmentation is ______.(Answer in integer)?

Attempted by 68 students.

Show answer & explanation

Correct answer: 65468

Disk block size: 64 K bytes = 2^16 = 65,536 bytes

Each block reserves 4 bytes for the pointer to the next block.

Data space available per block = 65,536 − 4 = 65,532 bytes

File size: 1 M = 2^20 = 1,048,576 bytes

Number of blocks required = ceil(1,048,576 / 65,532) = ceil(16.000976...) = 17 blocks

Data stored in 16 full blocks = 16 × 65,532 = 1,048,512 bytes

Remaining data to store in the 17th block = 1,048,576 − 1,048,512 = 64 bytes

  • Last block data used: 64 bytes

  • Internal fragmentation (wasted space) in last block = 65,532 − 64 = 65,468 bytes

Answer: 65468 bytes

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir