🎓 BookMCQ
← Back to 12. File System Implementation

📝 Counting Free Space Management (9 MCQs)

Recording Consecutive Free-Block Runs

Counting is a free-space management technique that records available storage as pairs containing a starting block address and the number of consecutive free blocks following it. Instead of maintaining a separate entry for every available block, the file system stores one entry for an entire free run. This approach is especially useful when storage allocation and deallocation create long consecutive regions.

Why Consecutive Free Regions Reduce Metadata Requirements

A bitmap records the allocation state of every block, while a linked list may maintain separate links for individual free blocks. When free space occurs in long consecutive runs, these structures can require more metadata than necessary. Counting compresses the representation by storing one starting address and a run length for each continuous region.

Starting Address and Run-Length Maintenance

The free-space manager searches a list of starting-address and block-count pairs. When a file requests several blocks, the allocator identifies a sufficiently large run and reduces its count or splits the run. When blocks are released, adjacent free ranges can be combined into a larger run, updating the corresponding records.

Representing a Free Run of Twenty Blocks

Suppose blocks 100 through 119 are free. Counting records this region as the pair (100, 20), meaning that 20 consecutive blocks begin at block 100. A request for six blocks can allocate 100 through 105, leaving the remaining free run represented by (106, 14).

Compact Metadata and Fragmentation Sensitivity

Counting is efficient when large contiguous free regions are common because it reduces the number of free-space records. It also supports requests for consecutive blocks directly. However, heavy fragmentation creates many short runs and increases record-management overhead. Splitting, merging, and updating counts must be performed consistently to avoid overlapping allocations or lost free-space information.

Clarifying Run Length and Individual Blocks

'A count represents the number of allocated blocks' is incorrect because the structure records free runs. 'One counting entry always represents one block' is incorrect because it may describe many consecutive blocks. 'Counting can combine physically separated free blocks into one run' is incorrect because the represented blocks must be consecutive.

Exam Focus: Starting Addresses and Run Calculations

Interpret free-space entries as starting-block and consecutive-count pairs. Calculate the remaining run after allocation and combine adjacent regions after deallocation. Compare counting with bit vectors, linked lists, and grouping. Questions may also examine how fragmentation increases the number of counting entries and why the technique works particularly well with extent-based allocation.

Key Terms of Counting Free-Space Management

  • Counting - Records consecutive free-block runs.
  • Starting address - First block in a run.
  • Run length - Number of consecutive blocks.
  • Free extent - Continuous available storage region.
  • Splitting - Divides a free run.
  • Merging - Combines adjacent free runs.
2
Easy
4
Medium
3
Hard

📝 All Counting Free Space Management MCQs

Q1. What term describes the condition where free disk space is divided into many small, noncontiguous pieces?

A.External fragmentation ✅
B.Internal fragmentation
C.File locking
D.Disk mirroring
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: External fragmentation occurs when the free space on a disk is split into many isolated blocks that are too small to satisfy a new allocation request. It is different from internal fragmentation, which wastes space inside allocated blocks. Because the free chunks are scattered, the system may be unable to place a file even though the total free space is sufficient. Recognizing this term helps students understand why allocation strategies aim to reduce scattered holes and improve storage efficiency.

Q2. Why is the first‑fit allocation algorithm generally faster than best‑fit when searching for a free hole?

A.It scans the entire free list each time
B.It stops at the first hole that is large enough ✅
C.It sorts holes by size before searching
D.It uses a hash table to locate holes
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: First‑fit examines holes sequentially and stops as soon as it finds one that meets the size requirement, avoiding any further checks. Best‑fit, on the other hand, must continue scanning all remaining holes to identify the smallest sufficient one, which adds extra comparisons. The reduced number of operations makes first‑fit quicker, while both aim to allocate space efficiently, illustrating the speed‑versus‑utilization trade‑off.

Q3. A disk has free holes of sizes 4 KB, 12 KB, 8 KB, and 20 KB (in that order). A process requests a contiguous block of 10 KB. Which allocation strategy will successfully place the request in the first hole that can accommodate it?

A.Worst‑fit
B.First‑fit ✅
C.Best‑fit
D.Next‑fit
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: First‑fit scans the list from the beginning and selects the first hole whose size meets or exceeds the request. In this case, the 12 KB hole is the first that can hold 10 KB, so the allocation succeeds. Worst‑fit would choose the largest hole (20 KB), best‑fit would search for the smallest fitting hole (8 KB is too small, so it would also pick 12 KB but after scanning), and next‑fit depends on the last allocation point, making first‑fit the direct answer.

Q4. Three files of sizes 6 KB, 4 KB, and 8 KB are allocated sequentially using first‑fit on a disk that initially has a single free hole of 20 KB. After the allocations, the files are deleted in the order 6 KB, 8 KB, 4 KB. Which allocation strategy would most likely reduce the external fragmentation that results?

A.Worst‑fit
B.Next‑fit
C.Best‑fit ✅
D.Random‑fit
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Best‑fit always chooses the smallest hole that can satisfy a request, leaving larger holes untouched for future allocations. In the described sequence, using best‑fit would tend to keep a sizable contiguous region available, thereby limiting the creation of many small fragments after deletions. Worst‑fit would exacerbate fragmentation by carving out the largest space each time, while next‑fit and random‑fit do not explicitly aim to preserve larger free blocks, making best‑fit the most effective choice.

Q5. How does the trade‑off between allocation speed and storage utilization differ for first‑fit versus best‑fit algorithms?

A.First‑fit is slower but uses space more efficiently
B.Best‑fit is faster but creates more fragmentation
C.First‑fit is faster while both achieve similar utilization ✅
D.Best‑fit is slower and always yields lower utilization
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: First‑fit requires only a single pass to locate a suitable hole, so it completes quickly. Best‑fit must compare every free hole to find the smallest that fits, which adds overhead and slows the allocation. Although both algorithms can achieve comparable overall storage utilization, the extra search time of best‑fit does not guarantee a significant reduction in fragmentation, highlighting why first‑fit is often preferred for speed.

Q6. If a file starts at disk block b=150b = 150 and the system needs to access block i=7i = 7 of that file, which block address will be read?

A.b−ib - i
B.b×ib \times i
C.b+ib + i ✅
D.i−bi - b
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The direct‑access property of contiguous allocation allows the system to compute the physical address by adding the start block to the offset within the file. Using the given values, the calculation is 150+7=157150 + 7 = 157. Therefore, the block at address 157 will be read. The other expressions either subtract, multiply, or reverse the order, leading to incorrect addresses and illustrating the simplicity of contiguous block calculations.

Q7. A disk initially has free holes of 5 KB, 15 KB, and 10 KB. After allocating a file of 8 KB using first‑fit, and then deleting a file of 5 KB that was previously allocated at the start of the disk, what is the size of the largest contiguous free hole?

A.15 KB
B.13 KB
C.10 KB ✅
D.8 KB
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: First‑fit places the 8 KB file into the first hole that can accommodate it, which is the 15 KB hole, leaving a remainder of 7 KB. The free holes become 5 KB, 7 KB, and 10 KB. Deleting the previously allocated 5 KB file restores that region to a free hole of 5 KB, so the set of free holes is now 5 KB, 7 KB, and 10 KB. The largest contiguous free space remains the 10 KB hole, making option C correct; the other choices miscalculate the remaining sizes.

Q8. What is the main reason that external fragmentation becomes a problem only when the largest contiguous free chunk is smaller than a new request?

A.Because the total free space is irrelevant
B.Because the operating system cannot combine non‑adjacent chunks automatically ✅
C.Because files can only be stored in non‑contiguous blocks
D.Because fragmentation only affects read speed
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: External fragmentation refers to scattered free blocks that cannot be merged without moving existing data. When a request arrives that exceeds the size of the biggest single free chunk, the system cannot satisfy it despite having enough total free space spread across multiple holes. The inability to automatically coalesce non‑adjacent pieces forces the allocation to fail, highlighting why the size of the largest contiguous hole is the critical factor.

Q9. A file system uses a best‑fit strategy. The current free‑hole list contains blocks of sizes 6 KB, 9 KB, 12 KB, and 20 KB. A new file of 11 KB arrives. Which hole will the system allocate to this file?

A.6 KB
B.9 KB
C.12 KB ✅
D.20 KB
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Best‑fit selects the smallest hole that can still accommodate the request, minimizing wasted space. Among the available holes, 6 KB and 9 KB are too small, while 12 KB is the smallest size that is at least 11 KB. Therefore, the 12 KB hole will be chosen, leaving only 1 KB unused. Selecting the larger 20 KB hole would waste more space, and the smaller holes cannot hold the file, confirming option C as correct.)

🔗 Related Topics (MCQs)