Free Space Management
Free Space Management
Overview
As we know, there is limited space (hard disk) in our system. So, there should be
proper utilization of space or memory available in our system.
The Operating system works to allocate free space to the files when a file is
created. It also creates a free void space when a file is deleted from the system. For
doing all these tasks and managing spaces in our system, the operating system
works with the help of a free space management system and allocates and de-
allocates memory spaces simultaneously. In this article, we are going to learn
about these concepts
When a file is created, the operating system searches the free space list for the
required space allocated to save a file. While deletion a file, the file system frees
the given space and adds this to the free space list.
Methods of Free Space Management in OS
It is not easy work for an operating system to allocate and de-allocate memory
blocks (managing free space) simultaneously. The operating system uses various
methods for adding free space and freeing up space after deleting a file. There are
various methods using which a free space list can be implemented. We are going to
explain them below-
A bit vector is a most frequently used method to implement the free space list. A
bit vector is also known as a Bit map. It is a series or collection of bits in which
each bit represents a disk block. The values taken by the bits are either 1 or 0. If
the block bit is 1, it means the block is empty and if the block bit is 0, it means the
block is not free. It is allocated to some files. Since all the blocks are empty
initially so, each bit in the bit vector represents 0.
2 - Linked List
3 - Grouping
In memory space, several files are created and deleted at the same time. For which
memory blocks are allocated and de-allocated for the files. Creation of files occupy
free blocks and deletion of file frees blocks. When there is an entry in the free
space, it consists of two parameters- "address of first free disk block (a
pointer)" and "a number 'n'".