📝 Space maps Free Space Management (9 MCQs)
Recording Free and Allocated Storage Extents
Space maps are storage-management structures that record information about allocated and available regions within a storage pool. They represent space through extent descriptions rather than necessarily maintaining one separate entry for every block. File systems and volume managers use such structures to track allocation changes, identify reusable regions, and support scalable storage management across large volumes.
Why Large Storage Pools Need Extent-Based Tracking
Modern storage pools may contain millions or billions of addressable blocks. Maintaining detailed allocation information for every block can create significant memory and metadata overhead. Space maps reduce this cost by representing ranges and recording allocation changes. Their effectiveness depends on the amount of free-space fragmentation and how frequently allocation updates occur.
Extent Records and Allocation-Change Tracking
The allocator identifies an available extent and records its starting position and length. When space is allocated, the corresponding range is removed or divided into smaller free extents. When storage is released, the range becomes available again and may be merged with adjacent regions. Implementations may maintain summaries or indexed structures to locate suitable extents efficiently.
Allocating a Portion of a Large Free Extent
Suppose a space map records a free extent beginning at block 1000 and containing 500 consecutive blocks. A file requests 120 blocks. The allocator assigns blocks 1000 through 1119, leaving a remaining free extent beginning at block 1120 with 380 blocks. The map records the revised allocation state.
Scalable Metadata and Fragmentation Management
Extent-based space maps reduce metadata overhead when large continuous regions remain available and support efficient allocation of contiguous ranges. Heavy fragmentation increases the number of individual extents and makes searches more expensive. Persistent updates must also remain consistent after interruptions. Some file systems use transaction records, checksums, or copy-on-write techniques to protect space-map metadata.
Common Misconceptions About Space Maps
'A space map always stores one bit per block' is incorrect because extent-based representations record ranges. 'Every free extent must contain the entire volume' is incorrect because multiple smaller regions can exist. 'Updating a space map automatically allocates file contents' is incorrect because it tracks allocation information rather than storing the file's actual data.
Exam Focus: Extents and Free-Space Map Updates
Read extent records containing starting addresses and lengths. Calculate remaining free regions after an allocation and identify adjacent extents that can be merged. Explain how range-based tracking reduces metadata overhead compared with per-block representations. Questions may also examine fragmentation, metadata persistence, and the role of space maps in managing large storage pools.
Key Terms of Space Maps
- Space map - Records storage allocation ranges.
- Extent - Consecutive block region.
- Free extent - Available storage range.
- Allocation record - Describes allocated space.
- Fragmentation - Divides available storage.
- Metadata - Information describing allocation.
📝 All Space maps Free Space Management MCQs
Q1. A file begins at disk block 120. To directly access the 7th block of the file, which disk block address must be read?
📖 Explanation: The file starts at block 120, and direct access to the i‑th block uses the formula block = b + i. Substituting b = 120 and i = 7 gives 120 + 7 = 127, so block 127 must be read. Option A matches this calculation. Options B, C, and D are off by one or more because they use incorrect arithmetic. Understanding the simple addition helps students translate logical block numbers to physical disk addresses.
Q2. Which allocation strategy always chooses the smallest free hole that can satisfy a request?
📖 Explanation: Best fit searches the list of free holes and selects the smallest hole that is still large enough for the request, thereby minimizing wasted space. This definition matches option B. First fit chooses the first hole that fits, which may be larger than necessary. Worst fit picks the largest hole, and next fit continues searching from the last allocated position, neither of which guarantee the smallest suitable hole. The explanation reinforces the concept of minimizing internal waste.
Q3. Given free holes of sizes 10, 8, 20, and 6 blocks (in that order) and a request for 7 blocks, which allocation algorithm will leave the smallest amount of unused space after allocation?
📖 Explanation: The free‑hole list contains blocks of sizes 10, 8, 20, and 6 in that order. A request for 7 blocks can be placed in any hole of size at least 7. First fit examines holes sequentially and would allocate the first hole of size 10, leaving 3 unused blocks. Best fit examines all holes and chooses the smallest that fits, which is the 8‑block hole, leaving only 1 unused block. Worst fit would choose the 20‑block hole, wasting 13 blocks. Therefore, best fit leaves the smallest leftover space, making option B correct. The other options either leave more waste or are irrelevant to the selection criteria.
Q4. A disk has free holes of sizes 10, 20, 5, and 15 blocks (in that order). A request for 12 blocks arrives. Which hole will first fit allocate?
📖 Explanation: The free holes are listed as 10, 20, 5, and 15 blocks. First‑fit scans from the beginning and stops at the first hole whose size is at least the request size of 12 blocks. The hole of 10 blocks is too small, so the algorithm moves to the next hole, which is 20 blocks and satisfies the request. Consequently, option B is the hole that first‑fit will allocate. The other holes are either smaller than needed (10, 5) or appear later in the list (15) and would not be chosen by first‑fit for this request.
Q5. In general, which statement best describes the time performance of first‑fit compared with best‑fit allocation?
📖 Explanation: First‑fit typically stops scanning as soon as it finds a hole large enough, so it often requires fewer comparisons than best‑fit, which must examine the entire free list to locate the smallest suitable hole. Because of this early‑exit behavior, first‑fit tends to be faster in practice, even though both algorithms have the same worst‑case time complexity of O(n). Option C correctly states this relationship. Options A and B reverse the speed comparison, and option D incorrectly claims identical performance without considering the early‑exit advantage.
Q6. A file needs 35 contiguous blocks but the largest free chunk is only 30 blocks. Which allocation method can store the file without requiring defragmentation?
📖 Explanation: When the largest contiguous free region is only 30 blocks but a file needs 35 blocks, a contiguous allocation cannot accommodate it without moving other files. Linked allocation stores each file block in any free block and links them together, so the file can be placed across multiple non‑contiguous regions. Therefore, linked allocation (option A) allows the file to be stored without immediate defragmentation. Contiguous allocation (option B) would fail, while indexed and multi‑level indexing still assume at least one contiguous region for the index blocks, making them unsuitable for this specific lack of space.
Q7. Even though best‑fit often yields higher space utilization, it can increase overhead. What is the main cause of this overhead?
📖 Explanation: Best‑fit reduces wasted space by choosing the smallest hole that fits a request, but to do so it must compare the request size with every free hole to ensure the optimal choice. This exhaustive search increases CPU time and may require more frequent updates to the free‑list data structure, leading to higher overhead. Option C captures this main cause. Options A and B describe unrelated overhead sources, and option D mentions copying files, which is not part of the allocation decision process.
Q8. Initially the free list contains holes of 10, 12, and 15 blocks. Files of sizes 8, 12, and 6 blocks are allocated using first‑fit. After these allocations, what is the total amount of external fragmentation (sum of leftover free space)?
📖 Explanation: The initial free holes are 10, 12, and 15 blocks. Using first‑fit, the 8‑block file occupies the first hole (10), leaving 2 blocks free. The 12‑block file fits exactly into the second hole (12), leaving 0 blocks. The 6‑block file then uses the third hole (15), leaving 9 blocks. Adding the leftovers gives 2 + 0 + 9 = 11 blocks of external fragmentation. Option C correctly reports this total. The other options miscalculate the remaining space by either ignoring one hole or adding incorrect leftovers.
Q9. What term describes the condition where free space is divided into many small noncontiguous pieces?
📖 Explanation: External fragmentation describes the situation where free space exists on the disk but is broken into many small, non‑contiguous pieces, preventing allocation of large files despite having enough total free space. This definition matches option B. Internal fragmentation refers to wasted space inside allocated blocks, while contiguous allocation and block mapping are techniques, not conditions. Thus, option B is the correct term for the described phenomenon.