Computer Science & Information TechnologyOperating System

FILE ALLOCATION METHODS

The main problem is how to allocate space to a file so that disk space is utilized effectively and file can be accessed quickly. There are three major methods of allocating disk space:

1. Contiguous allocation
2. Linked allocation
3. Indexed allocation

Other methods are
4. Clustering
5. FAT
6. Linked indexed allocation
7. Multilevel indexed allocation
8. Inode

Contiguous Allocation

  • Each file is allocated a set of contiguous disk blocks.
  • The contiguous allocation method requires each file to occupy a set of contiguous blocks on the disk.
  • Disk addresses define a linear ordering on the disk. With this ordering, accessing block b + 1 after block b normally requires no head movement.
  • Contiguous allocation of a file is defined by the disk address of the first block and length (in block units).
  • If the file is n blocks long, and starts at location b, then it occupies blocks b, b + 1, b + 2,.. b + n –1
  • For sequential access: seek to b and read and read next.
  • For direct access: if we want block i of a file that starts at block b, seek to block b + i and read.
  • The directory entry for each file indicates the address of the starting block and the length of the area allocated for this file.

What happens if we want to allocate more blocks to a file?

We could copy the file to a space that would allow growth. If we allocate a maximum blocks to allow growth, we waste blocks. Some operating systems use a modified contiguous allocation scheme.

  • A chunk of contiguous space is allocated initially.
  • When that isn’t enough, another chunk of contiguous space is allocated

Dear Aspirants,
Your preparation for GATE, ESE, PSUs, and AE/JE is now smarter than ever — thanks to the MADE EASY YouTube channel.
This is not just a channel, but a complete strategy for success, where you get toppers strategies, PYQ–GTQ discussions, current affairs updates, and important job-related information, all delivered by the country’s best teachers and industry experts.
If you also want to stay one step ahead in the race to success, subscribe to MADE EASY on YouTube and stay connected with us on social media.
MADE EASY — where preparation happens with confidence.

MADE EASY

MADE EASY is a well-organized institute, complete in all aspects, and provides quality guidance for both written and personality tests. MADE EASY has produced top-ranked students in ESE, GATE, and various public sector exams. The publishing team regularly writes exam-related blogs based on conversations with the faculty, helping students prepare effectively for their exams.

Leave a Reply

Your email address will not be published. Required fields are marked *