The system keeps tracks of the free disk blocks for allocating space to files when they are created. Also, to reuse the space released from deleting the files, free space management becomes crucial. The system maintains a free space list which keeps track of the disk blocks that are not allocated to some file or directory.
The free space list can be implemented mainly as:
1. Bitmap or Bit vector
A Bitmap or Bit Vector is series or collection of bits where each bit corresponds to a disk block. The bit can take two values: 0 and 1: 0 indicates that the block is allocated and 1 indicates a free block.
The given instance of disk blocks on the disk in Figure 1 (where green blocks are allocated) can be represented by a bitmap of 16 bits as: 0000111000000110.
Advantages:
The block number can be calculated as:
(number of bits per word) * (number of 0-values words) + offset of bit first bit 1 in the non-zero word.
For the Figure-1, we scan the bitmap sequentially for the first non-zero word.
The first group of 8 bits (00001110) constitute a non-zero word since all bits are not 0.
After the non-0 word is found, we look for the first 1 bit. This is the 5th bit of the non-zero word. So, offset = 5.
Therefore, the first free block number = 8 * 0 + 5 = 5.
2. Linked List
In this approach, the free disk blocks are linked together i.e. a free block contains a pointer to the next free block. The block number of the very first disk block is stored at a separate location on disk and is also cached in memory.
In Figure-2, the free space list head points to Block 5 which points to Block 6, the next free block and so on. The last free block would contain a null pointer indicating the end of free list.
A drawback of this method is the I/O required for free space list traversal.
3. Grouping
This approach stores the address of the free blocks in the first free block. The first free block stores the address of some, say n free blocks. Out of these n blocks, the first n-1 blocks are actually free and the last block contains the address of next free n blocks.
An advantage of this approach is that the addresses of a group of free disk blocks can be found easily.
4. Counting
This approach stores the address of the first free disk block and a number n of free contiguous disk blocks that follow the first block.
Every entry in the list would contain:
When you write data to a storage medium whether it’s a hard drive or an SSD or an SD card or a micro SD card or a USB flash drive you need to write the data in such a way that it can be found again. You can’t just write it randomly on a drive and then expect to get it back one day when you need it. It needs to be organized and that organization is called a file system.
A File System is a collection of rules and algorithms that is responsible for translating logical file operations to the physical storage of information. In simpler words, we can say that the file system controls the flow of storage and retrieval of data in a device.
There are 3 types of the file system in a device:
As mentioned earlier when you store a file on a disk, the operating system needs to know where the file is physically located. It needs to have a way to associate a file name with that file’s contents. In addition to that, there might be other things like folders and file permissions, etc. In this article, we will look into the key difference between them.
1. FAT32
FAT32 or the File Allocation Table file system is one of the oldest file systems available on the Windows machine. It was first introduced on MS-DOS 7.1 / Windows 95 OSR2 in 1996 replacing the previous FAT16 file system. It was originally developed for floppy disks however over the years it found its way onto the hard drive, USB flash drives, and SSD cards, and it was the default file system for windows up until Windows XP. There have been several variations of FAT, based on the size of the table as it’s a file allocation table that holds information about the files like FAT8, FAT12, and FAT16. FAT32 is almost universally understood not only by PCs running Windows but also Linux, macOS, cameras, media players, game consoles, smart TVs, Android phones, and so on. Being one of the oldest file systems, it has some profound limitations.
But there are also some advantages of using a FAT32. They are listed below:
Advantages:
Limitations:
2. exFAT
The extended File Allocation Table system or exFAT was designed by Microsoft and introduced in 2006. It allows for files larger than 4GB. It was adopted by the SD card association for the default file system of cards greater than 32GB. The limits of exFAT are measured in PetaBytes(PB) and ExaBytes(EB). It is important to note that if an OEM wants to use exFAT it needs to pay for the license to Microsoft.
Advantages:
Limitations:
3. NTFS
The New Technology File System or NTFS was developed for Windows NT, and it was a default file system for all the members of the Windows NT family of operating system right up until Windows XP which kind of combined NT and the framework of the traditional windows together. On Windows XP and the NTFS became the default for Windows including Windows 10 which you may well be using today. The file sizes in NTFS are measured in ExaBytes(EB).
Advantages:
Limitations:
10 videos|99 docs|33 tests
|
1. What is free space management in an operating system? |
2. How does free space management work in an operating system? |
3. What is fragmentation, and how does it affect free space management? |
4. What are the common techniques used for free space management? |
5. How does file system fragmentation impact free space management? |
|
Explore Courses for Computer Science Engineering (CSE) exam
|