File Allocation Methods in OS - Linked Allocation

By:   Last Updated: in: ,

Operating System: Q1.File Allocation Methods in OS? - Linked Allocation, Contiguous Allocation, Indexed Allocation. (Operating System all notes)

File-Allocation-Methods-in-OS

Q1. Explain the accessing methods used for searching in these file organization schemes? or File Allocation Methods in OS?

Ans. Allocation Method: Disks are the storing devices that can store a large number of files. The important point that we need to consider when storing files is that we should allocate space to these files in such a manner that space can be utilized effectively.

As a result, it helps in accessing files quickly. There are three methods used for allocating space to files: contiguous allocation, linked allocation, and indexed allocation.
File-Allocation-Methods-Diagram

1. Contiguous Allocation: File Allocation Methods in OS

According to this method, every file occupies a set of contiguous blocks on the disk. e.g. there is only a single job accessing the disk. The head movement of the disk is not required, if a job accesses blocks B + 1 after the block B.

If there is a need for the head movement, then the head moves from one track to next. Therefore, this allocation method requires minimum disk seeks. Due to its better performance, this allocation method is used by several systems.

2. Linked Allocation: File Allocation Methods in OS

In this method, every file is linked list of disk blocks. These disk blocks are present all over the disk. This allocation method removes all the limitations of the contiguous allocation method. Every block contains a pointer for the next block. These pointers are not available to users.

e.g.: If the size of a block is 512 bytes and the pointer requires 4 bytes, then the bytes available to the user are 508.

In this, there is a file, which consists of five blocks. It starts at block 8 and continues to block 18, then to block 1, then to block 11 and finally it lasts at block 22.

In this, there is a file, which consists of five blocks. It starts at block 8 and continues to block 18, then to block 1, then to block 11 and finally it lasts at block 22.
Linked-Allocation-Methods-in-OS

3. Indexed Allocation: File Allocation Methods in OS

This method of allocation solves all the problems of the linked allocation method. It solves the problem by bringing all the pointers at a particular place, which is known as the index block.

An individual index block is provided to every file and it contains all the disk block addresses. The Kth entry points to the Kth block of the file. We can find and read the Kth block by using the pointer in the Kth index block. When creating a file, all the pointers are set to nil.

This method solves the external fragmentation problem to direct method by allowing any block to satisfy a request for large space. Also, no space is wasted in this method and by using any of the following schemes.
Indexed-Allocation-Methods-in-OS

Q2. Advantages and Disadvantages of Indexed Allocation?

Ans. The advantages and disadvantages of linked allocation are as follows:

Advantages of linked allocation:

(i) Its simplicity.
(ii) No disk compaction required. Because of the non-contiguous nature of allocation, the linking does not produce any external disk fragmentation. Any disk block on the free space can be used to satisfy a request. since all blocks are linked together.

There is also no need of declaration of the size of a file in linked allocation while it is created. A file can continue to grow as there are free blocks. Consequently, it is never necessary to have disk compaction.

Disadvantages of linked allocation:

(i) Slow Direct Accessing of any Disk Block: To find out the Nth block of a file, we must start at the beginning of that file and follow the pointer until we get to the Nth block.

(ii) Space Requirement for Pointers: If a pointer requires two words out of a 512 words block, then around 39 percent of the disk is being ponded only for pointers, not for information. Each file therefore requires more space.

(iii) Reliability: Since disk blocks are linked by pointers, a single damaged pointer can make thousands of disk blocks inaccessible. Some operating systems address this problem by storing pointers in a dedicated file and making redundant copies of it.

The idea is to copy the list of pointers into the main memory and thus facilitate faster access of disk blocks. The redundancy of pointers files is employed for safer recovery.




[ Topic= File Allocation Methods in OS ]
[ Topic= File Allocation Methods in OS ]
[ Topic= File Allocation Methods in OS ]



Join us on Facebook, Instagram, and Twitter to get the latest study material. You can also ask us any questions.
Facebook = @allbcaweb
(click on it or search "allbcaweb" on Facebook)
Instagram = @allbcaweb
(click on it or search "allbcaweb" on Instagram)
Twitter = @allbcaweb
(click on it or search "allbcaweb" on Twitter)
Email= allbca.com@gmail.com
Send us your query anytime about File Allocation Methods in OS!


External Links:-

1. File Allocation Methods in OS - (click here)
2. File Allocation Methods in OS - (click here)


[ Topic= File Allocation Methods in OS ]

No comments:
Write comment