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 ____________. (answer in integer)
Note: 1K=2^10 and 1G=2^30
GATE 2026 CS2 Q.53: solution and answer
Answer and solution
ANSWER
The free list needs 16417 blocks.
Official answer: 16417Source: Official answer key, GATE 2026 CS2 (IIT Guwahati)
Number of disk blocks: . The free list must be able to hold the numbers of all these blocks, so block numbers are stored.
Each block number is 32 bits bytes.
Each list block is bytes, and 4 bytes of it hold the pointer to the next list block. Space for block numbers bytes.
Block numbers per list block .
List blocks needed .
, so block numbers are left over and need one more block.
Number of blocks .
KEY IDEA
Count the blocks on the disk, then see how many 4-byte block numbers fit in one list block after setting aside 4 bytes for the next-block pointer. Divide and round up.
WATCH OUT FOR
Using all 2048 bytes for block numbers gives 512 per block and . This forgets that 4 bytes of each list block hold the pointer to the next list block.
From the GATE 2026 CS2 paper. Every question of this paper · Download the full paper · All 6 File systems & disks questions, with notes
More File systems & disks questions
- GATE 2022 CS Q.63 · NAT · 2 marksConsider two files systems A and B, that use contiguous allocation and linked allocation, respectively.
- GATE 2020 CS Q.35 · MCQ · 2 marksConsider the following five disk access requests of the form (request id, cylinder number) that are present…
- GATE 2018 CS Q.53 · NAT · 2 marksConsider a storage disk with 4 platters (numbered as 0, 1, 2 and 3), 200 cylinders (numbered as 0, 1…
