ð 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.
ð All Counting Free Space Management MCQs
Q1. What term describes the condition where free disk space is divided into many small, noncontiguous pieces?
ð 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?
ð 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?
ð 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?
ð 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?
ð 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 and the system needs to access block of that file, which block address will be read?
ð 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 . 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?
ð 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?
ð 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?
ð 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.)