To keep track of free blocks in a file system, one of the two approaches is…

2026

To keep track of free blocks in a file system, one of the two approaches is generally used – using bitmaps (bit vectors) or using linked lists. Consider that the linked list approach is used to keep track of free blocks in a file system. Assume that the disk size is 16 GB, block size is 2 KB, and block numbers used are 32-bit long. A single pointer of size 4 bytes is used in each block of the list to point to the next block of the list. The number of blocks required to hold the free disk block numbers is __________________ .

Attempted by 6 students.

Show answer & explanation

Correct answer: 16384

Step 1: Calculate the total number of blocks on the disk.

Disk Size = 16 GB = 16 * 2^30 bytes.

Block Size = 2 KB = 2 * 2^10 bytes.

Total Number of Blocks = (16 * 2^30) / (2 * 2^10) = 8 * 2^20 = 8,388,608 blocks.

Step 2: Calculate total space required for pointers.

In a linked list approach, each block stores a pointer to the next free block.

Pointer Size = 4 bytes.

Total Pointer Space = 8,388,608 * 4 bytes.

Step 3: Calculate blocks required to store pointers.

Blocks Required = (Total Pointer Space) / Block Size

= (8,388,608 * 4) / 2048 = 16,384 blocks.

Final Answer: 16384

Explore the full course: Gate Guidance By Sanchit Sir