×

Free Space Management in Operating System

What is Free Space Management?

The system always keeps the records of the free disks blocks for allocating space to files when they are created. To use the space free from removing the files, free space management becomes critical. The system maintains a free space list which keeps record of the disk blocks that are not assigned to some file or directory.

Free Space Management in Operating System

When file is created, operating system searches the free space register for saving the file. During deletion the file, the computer system frees the given space and attaches this to the “free space list”.

There are four methods used in the free space management of operating system. There are as follows:

  1. Bitmap or Bit vector
  2. Linked list
  3. Grouping
  4. Counting

Bitmap or Bit vector

A bitmap is a group of bits where each bit corresponds to a disk block. It can take two values: 0 and 1, where 0 indicates that the block is allocated and 1 indicates the free block. This is the most common method used to implement the free space list. In this method, each block in the hard disk is implemented by a bit.

Advantages of Bit vector

Advantages of bit vector are as follows:

  1. It is simple and easy to understand.
  2. It consumes less memory.
  3. It is well organized to find free space.

Disadvantages of Bit vector

Disadvantages of bit vector are as follows:

  1. OS goes through the all blocks unless it finds a free block.
  2. To find a free block, OS may need to search the entire bit vector.
  3. It requires a special hardware support in some conditions.

Linked list

In this method, the free disk blocks are attached together. A free block carries a pointer to the next free block. The block number of the very first disk block is collected at a separate location on disk and also cached in memory. This method has a major disadvantage that it requires for free space list traversal. This entire process is known as linked list.

Advantages of linked list

Advantages of linked list are as follows:

  1. In this method, accessible space is used effectively.
  2. As there is no size limit on a linked list, new space can be allocated easily.

Disadvantages of linked list

Disadvantages of linked list are as follows:

  1. In this method, the overhead of maintaining the pointer appears.
  2. The linked list is not efficient when we need to reach each block of the memory.

Grouping

This is also an important method for free space management. In this method, there is a modification of free list takes place which stores the address of the n free blocks. In grouping, the initial n-1 blocks are free but the last block carries the address of n blocks. When we use the standard linked list, the address of the higher number of blocks can be found very quickly. In grouping, we cannot keep a list of n free disk addresses but we keep address the initial free block. This whole process is known as grouping.

Advantages of grouping

Advantages of grouping are as follows:

  1. The address of higher number of free blocks can be found very quickly.
  2. Grouping is a type of method which has a benefit of making it simple to locate the addresses of collection of empty disk blocks.
  3. The modification of free list takes place that’s why there is no need to pass over the whole list.

Disadvantages of grouping

Disadvantages of grouping are as follows:

  1. The major disadvantage of grouping method is that the space of block is wasted in storing addresses. Nth block is used to collect the addresses of next free blocks.
  2. Addresses of initial free blocks can be saved but we are not able to maintain the list of all n free disk addresses.
  3.  It is very costly in maintaining the index of blocks.

Counting

Here, counting is the last method of free space management in operating system. This method is also used in the modification of the linked list method. This method has an advantage most of contiguous blocks can be freed concurrently. In this type of method linked list is maintained as well as the pointer to the next free block that come after first block is also preserved. There is no need to traverse the whole list. This whole process is known as counting.

Advantages of counting

Advantages of counting are as follows:

  1. Fast allocation of higher number of consecutive free blocks.
  2. Random access to the free block can be performed.
  3. Entire list is generally smaller in size.

Disadvantages of counting

Disadvantages of counting are as follows:

  1. Every free block requires huge space to keep the count in the disk.
  2. To perform traversal operations, we have to store the entries in B-tree.
  3. Whole area got reduced in counting.

Related Topics

What is Demand Paging?

Demand Paging is defined as a process in which the pages are loaded into the memory (when the page fault occurs) or on-demand. It consists of the following steps: If there is...

4 minutes read.

Process Management in OS

A Program will not do anything unless a CPU executes its instructions. An executing program is called a process. The Process requires computer resources to complete its task. More than...

3 minutes read.

Look Disk Scheduling

Look Disk Scheduling Look disk scheduling is another type of disk scheduling algorithm. Look scheduling is an enhanced version of SCAN disk scheduling. Look disk scheduling is the same as SCAN disk scheduling,...

4 minutes read.

Directory Structure in Operating System

Directory Structure in Operating System What is a Directory A Directory is the collection of the correlated files on the disk. In simple words, a directory is like a container which contains...

8 minutes read.

Android Operating System

What is Android Operating System? Android is a Linux-based and open-source operating system mainly established for mobile devices like tablet computers and Smartphones. The Android operating system was established by the...

5 minutes read.

Non-Contiguous Memory Allocation in Operating System

Memory is nothing but a storage space where various data are stored. We can store data in temporary and permanent memory as per our future requirements for data. We can...

9 minutes read.

Operating System Properties

The Properties of Operating System are: Batch processingMultitaskingMulti-programmingInteractivityReal-Time SystemDistributed Environmentspooling 1. Batch Processing In Batch Processing, the OS first gathers the data and programs together in a batch, then processing starts. The operating system...

3 minutes read.

What is Context Switching

Context Switching is the switching of CPU from one process to another process. Context switching means storing the process state so that we can reload the process when needed, and the execution...

3 minutes read.

Difference between SSTF and LOOK Disk Scheduling Algorithm

Shortest Seek Time First / SSTF Shortest Seek Time First (SSTF) is an acronym for "shortest seek time first." The task request that is closest to the present position of the...

4 minutes read.

Process State in OS

The Process passes from different states, from its formation to completion. The following are the states of the Process. NewReadyRunningBlock or WaitTerminated or CompletedSuspend readySuspend wait or suspend blocked 1. New: - The state in which a process...

2 minutes read.

What is Scheduling on OS

Scheduling is the process which is used to share the computing resources such as memory, processor time, and bandwidth to the different processes, data flows, threads, and applications which need them. Scheduling is...

5 minutes read.

Dining Philosophers Problem in Operating System

Edsger Wybe Dijkstra was a well-known Dutch scientist. He was the first person ever to present the Dining Philosophers Problem in the stream of Computer Science. The dining philosophers problem...

5 minutes read.

Two Phase Locking Protocol

What is two phase locking? Two-phase locking is a concurrency control method in a database and transaction processing system. It ensures that transactions are executed in a serializable manner by requiring...

4 minutes read.

Difference between Rotational Latency and Disk Assess Time in Disk Scheduling

Disk scheduling is used by operating systems to arrange the arrival of I/O requests to the disc. Disk scheduling is necessary because several I/O requests may occur from various processes,...

4 minutes read.

What is Thread and Types of Thread

What is Thread A thread means a lightweight process. Thread is the basic unit of CPU execution, which consists of thread ID, Program counter, set of registers to hold the information of current...

7 minutes read.

Test Set Lock Mechanism | Operating System

Modification in the Assembly Code The problem in the lock variable is that, in some cases, the process reads the previous or old value of the lock variable and enters into the critical...

4 minutes read.

Functions of Operating System

The functions of Operating System are: Process Management Memory Management File Management Device Management Secondary storage Management Security Coordination between other software and users Networking Job Accounting Error detecting aids 1. Process Management Process Management support operating system to create and delete...

3 minutes read.

Process Synchronization | Operating System

Process Synchronization Process Synchronization means managing the process in such a manner so that no two processes have access to share similar data and resources. We can use Process Synchronization in a Multi-Process System...

4 minutes read.

Producer-Consumer Problem in OS

What is Producer-Consumer Problem? The Producer-Consumer problem is a classical problem. The Producer-Consumer problem is used for multi-process synchronization, which means synchronization between more than one processes. In this problem, we have one producer...

4 minutes read.

Operating System Tutorial

What is an Operating System? An Operating System is a System Software that handles the resources of a computer such as computer hardware and software and offers frequent services to the...

7 minutes read.