Assume binary units (1 GiB = 2^30 bytes and 1 KiB = 2^10 bytes). A 16 GiB disk…

2014

Assume binary units (1 GiB = 2^30 bytes and 1 KiB = 2^10 bytes). A 16 GiB disk uses 1 KiB blocks. To store a linked list that contains one 32-bit number for every disk block, each list block reserves one of its 32-bit slots for the pointer to the next list block. How many list blocks are required?

Answer: A. 65,794 blocksConcept: In this maximum-list model, the list stores one number for every disk block. Each list block contains fixed-width disk-block numbers and one link to…

  1. A.

    65,794 blocks

  2. B.

    65,536 blocks

  3. C.

    20,000 blocks

  4. D.

    1,048,576 blocks

Attempted by 135 students.

Show answer & explanation

Correct answer: A

Concept: In this maximum-list model, the list stores one number for every disk block. Each list block contains fixed-width disk-block numbers and one link to the next list block. If a block has S pointer-sized slots, only S − 1 slots store disk-block numbers. Therefore the minimum list-block count is ceil(total disk-block numbers ÷ numbers stored per list block).

Application:

  1. Total disk blocks = disk size ÷ block size = 16 GiB ÷ 1 KiB = 234 bytes ÷ 210 bytes = 224 = 16,777,216 blocks.

  2. A disk-block number occupies 32 bits = 4 bytes. A 1 kB block has 1024 ÷ 4 = 256 such slots; reserving one slot for the next-block pointer leaves 255 free-block numbers per list block.

  3. Required list blocks = ceil(16,777,216 ÷ 255) = ceil(65,793.0039…) = 65,794 blocks.

Cross-check: 65,793 × 255 = 16,777,215, which is one entry short, whereas 65,794 × 255 = 16,777,470, which covers all 16,777,216 disk-block numbers. Thus 65,794 is the smallest sufficient integer count.

Result: 65,794 blocks.

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

Explore the full course: Isro

Loading lesson…