Free Space Management in Operating Systems: Methods, Bitmap Math and a Worked Example
Learn what bitmaps, linked lists, grouping and counting record, then follow a 64 GiB partition example from raw bitmap size to allocation and coalescing.
KnowledgeGate Team
Exam prep & CS education

After files are created and deleted, a file system must know which disk blocks can be reused without overwriting live data. Students often mix this up with how a file's blocks are organised. Free-space management records reusable disk blocks, while file allocation records which blocks belong to each file and in what order; bitmap, linked list, grouping and counting are four textbook methods.
File Management in Operating Systems: Allocation, Directories and Worked Examples connects directories, allocation, protection and crash consistency across the full file lifecycle. Free-space calculations isolate the block-accounting layer: representation, bitmap size, allocation updates and coalescing. The CS Fundamentals for Exams & Placements path places that layer beside the wider operating-systems syllabus.
What free-space management records
A disk block is a fixed-size unit that the file system can use for storage. An allocated block is currently assigned to live file-system content, while a free block is available for reuse. The free-space data structure records this availability. Its basic invariant is strict: every usable block must be represented as either free or allocated, never both.
Free-space management therefore answers, "Which blocks are available?" File allocation answers, "Which blocks belong to this file, and in what order?" File Systems and Allocation MCQs can reinforce the distinction between free-space management and file allocation.
The bitmap examples use 1 = free and 0 = allocated. A question can reverse that convention, so always obey its stated legend.
Bitmap, linked list, grouping and counting
Suppose the free blocks are {2, 3, 4, 5, 9, 10, 17, 18, 19, 20, 21, 27}. Each method records the same free set in a different form.
Method | Stored representation | Strong point | Cost or limitation |
|---|---|---|---|
Bitmap | One bit per disk block | Compact, and consecutive bits make free runs visible | Finding a run can require scanning bits |
Linked list | Each free block points to the next free block | Simple removal of one free block | Poor at locating a long contiguous run |
Grouping | One free block stores a batch of free-block addresses | Reduces pointer-by-pointer traversal | Batched addresses still need checking for adjacency |
Counting | Pairs of | Compresses clustered free space | Runs must be split or merged as space changes |
An ascending teaching version of the linked list is 2 -> 3 -> 4 -> 5 -> 9 -> 10 -> 17 -> 18 -> 19 -> 20 -> 21 -> 27 -> null. A real free list need not be sorted. Counting represents the same set as (2,4), (9,2), (17,5), (27,1). Grouping changes how addresses are fetched in batches, not which blocks are free.
Worked example, part A: exact bitmap size
Take a 64 GiB disk partition with 4 KiB blocks. Convert both sizes to bytes before dividing:
64 GiB = 64 × 2^30 bytes = 2^36 bytes.4 KiB = 4 × 2^10 bytes = 2^12 bytes.Number of blocks =
2^36 / 2^12 = 2^24 = 16,777,216 blocks.One bit per block gives
2^24 bits.Bitmap size =
2^24 / 8 = 2^21 bytes = 2 MiB.
That 2 MiB is only the raw bitmap. It excludes headers, redundancy, alignment and all other file-system metadata.
The units provide a quick correctness check: disk bytes divided by bytes per block gives blocks; blocks multiplied by one bit per block gives bits; bits divided by eight gives bytes.
Worked example, part B: decode and allocate
Now zoom into blocks 0-31 of the same disk. Read left to right, with the first bit representing block 0:
00111100 01100000 01111100 00010000
Because 1 = free, the free set is {2, 3, 4, 5, 9, 10, 17, 18, 19, 20, 21, 27}. It contains 12 blocks. At 4 KiB per block, this window has 12 × 4 KiB = 48 KiB free.
Suppose a file requests 5 contiguous blocks, and the allocator uses a left-to-right first-fit scan. The free runs are:
Blocks
2-5, length4Blocks
9-10, length2Blocks
17-21, length5Block
27, length1
The first two runs are too short. The first run that satisfies the request is 17-21, so those five blocks are allocated. Their bits change from 1 to 0, producing:
00111100 01100000 00000000 00010000
Seven free blocks remain, so the window now has 7 × 4 KiB = 28 KiB free. The counting representation becomes (2,4), (9,2), (27,1).

How allocation and freeing change the records
Allocating blocks 17-21 changes their bitmap bits from 1 to 0. A free list removes those five nodes. A grouping structure removes their entries and may replenish a depleted group. Counting deletes the exact-fit tuple (17,5).
Next, suppose allocated blocks 11-16 are released. The bitmap becomes 00111100 01111111 10000000 00010000. Blocks 9-10 were already free, so counting coalesces (9,2) with the newly freed (11,6) to form (9,8), covering blocks 9-16. The free runs are now (2,4), (9,8), (27,1). They contain 4 + 8 + 1 = 13 blocks, equal to 13 × 4 KiB = 52 KiB.
The safety rule is broader than any representation: update the free-space record and the file's allocation metadata as one consistent file-system operation.
Choose from the workload, not a ranking
There is no universal winner. A bitmap is compact and convenient when an allocator scans for runs. A plain linked list makes taking individual blocks simple, but the links alone do not reveal a contiguous run cheaply. Grouping reduces repeated traversal by supplying batches of addresses. Counting is compact when free space forms long runs, but changing those runs requires splitting and coalescing tuples.
For the request of 5 contiguous blocks, bitmap scanning finds five adjacent 1 bits at 17-21. Counting can match (17,5) directly. A linked list must verify that five encountered block numbers are consecutive. Grouping fetches addresses in batches, but the allocator must still check adjacency.
The important trap is visible here: 12 free blocks in total did not mean every five-block request could be served. Allocation depended on the shape of the free runs, and only one run had length 5.

How questions test free-space management
Questions on this topic commonly ask you to calculate bitmap storage from disk and block sizes, decode or update a supplied bit vector, derive counting tuples from a free-block set, or select a method for a stated workload.
Use these checks before committing to an answer:
Read the bit convention before decoding.
Keep bits, bytes, KiB and GiB distinct.
Divide disk capacity by block size before calculating bitmap space.
Distinguish a total count of free blocks from a contiguous free run.
Do not confuse a linked list of free blocks with linked allocation of one file.
A 20-second verification for this example is 2^36 / 2^12 = 2^24 blocks, followed by 2^24 / 8 = 2^21 bytes = 2 MiB. Then recount the free runs: 4 + 2 + 5 + 1 = 12. For the next storage-oriented practice topic, work through these disk-scheduling MCQs.
The short version and your next step
Bitmap means one bit per block.
Linked list means one free block points to another.
Grouping fetches free-block addresses in batches.
Counting stores a start block and run length.
For 64 GiB / 4 KiB, the raw bitmap is 2 MiB, and first fit selects blocks 17-21 for the five-block request. Redraw the 32-bit example with 0 = free and recompute it before checking your work. For a broad semester-level path, use ZERO TO HERO; for interview-focused revision, use CS Fundamentals for Placements.
Keep learning
File Management in Operating Systems: Complete GATE Guide with Worked Examples
Follow report.bin from its pathname to its inode and data blocks, compare three allocation methods, size a free-space bitmap, and calculate multi-level inode capacity.
File Management in Operating Systems: Allocation, Directories and Worked Examples
Connect a filename to its inode, open-file state, and physical blocks. Then compare allocation methods and solve one complete block-allocation example.
Process Management in Operating Systems: States, PCB and Scheduling Worked Examples
Connect the process lifecycle, PCB, queues and dispatcher, then calculate FCFS and Round Robin metrics through one complete scheduling example.
Memory Management in Operating Systems: Paging, Virtual Memory and Worked Examples
Connect allocation, paging, segmentation and virtual memory through one address-translation system, two access-time calculations and a full replacement trace.





