FREE SPACE MANAGEMENT


There is only a limited amount of disk space, it is necessary to reuse the space from deleted files for new files.

To keep track of free disk space, the system maintains a free-space list. The free-space list records all disk blocks that are free

The process of looking after and managing free blocks of disk is called Free Space Management

Free Space List records all free disk blocks that are not allocated to any file or directory.

Whenever, a new file is created, the free space list is searched for the required amount of space.

Then the space is allocated to that newly created file. Its entry is removed from the Free Space List.

There are some methods or techniques to implement free space list. These are as follows:

§  Bitmap

§  Linked Lists

§  Grouping

§  Counting

Bitmap:

When free space is list is implemented as bit map, each block of disk is represented by a bit.

If the block is free, its bit is set to 1. If the block is allocated, the bit is 0.

For Example: Apple Macintosh operating system uses bit map method to allocate the disk space.

Assume the following are free. Rest are allocated:

 

Advantages:

§  It is relatively simple.

§  Efficient to find the free space on the disk.

§  Fast random access allocation check

Disadvantages:

§  This may require special hardware support to find the first 1 in a word if it is not 0.

§  Wasteful on larger disks

§  Poor scalability

Linked List:

In this method, a linked list of all the free disk blocks is maintained.

The first free block in the list can be pointed out by a head pointer, which is kept in a special location on the disk.

Using this disk, It is not easy to search the free list. 

Advantages:

§  Whenever a file is to be allocated a free block, the operating system can simply allocate the first block in free space list and move the head pointer to the next free block in the list.

Disadvantages:

§  Searching the free space list will be very time consuming; each block will have to be read from the disk, which is read very slowly as compared to the main memory.

§  Not Efficient for faster access.

Grouping:

A modification of the free-list approach is to store the addresses of n free blocks in the first free block.

The first n-1 of these are actually free.

The last one is the disk address of another block containing addresses of other n free blocks.

The importance of this implementation is that addresses of a large number of free blocks can be found quickly.

Counting:

This method is based on the fact that we can allocate o free several contiguous blocks at the same time.

This method keeps the address of the first free block and the number n of the free contiguous blocks that follows the first block.

Each entry in the free-space list then consists of a disk address and a count.

Although each entry requires more space than would a simple disk address, the overall list will be shorter, as long as the count is generally greater than 1.

Advertisements

Give A message for us

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s