Q.21 Write a detail note on Allocation and Disk Scheduling Methods.
Solution :-
Allocation and Disk Scheduling Methods in Operating Systems.
In an operating system (OS), disk allocation and scheduling play a vital role in managing storage efficiently.
Allocation methods define how files are stored on disk, while disk scheduling algorithms determine the order in which disk access requests are processed.
Proper allocation and scheduling ensure faster access, efficient storage utilization, and reduced delays.
1. File Allocation Methods
File allocation methods define how disk space is assigned to files. The three main types are:
a) Contiguous Allocation
Each file occupies consecutive disk blocks.
Provides fast file access since the read/write head does not need to move frequently.
Causes fragmentation, making it difficult to store new files if a large enough continuous block is unavailable.
Example: Used in CD/DVD storage.
b) Linked Allocation
Each file consists of scattered blocks linked together via pointers.
Prevents fragmentation and allows flexible file storage.
Slower access time as the OS must follow pointers to find file blocks.
Example: Used in FAT (File Allocation Table) file systems.
c) Indexed Allocation
Uses an index table to store block addresses of a file.
Supports random access since block locations are stored in an index.
Requires additional space to store the index, increasing memory overhead.
Example: Used in modern file systems like NTFS and ext4.
2. Disk Scheduling Methods
Disk scheduling algorithms manage multiple requests to optimize disk read/write operations. The goal is to reduce seek time and improve overall system performance.
a) First-Come-First-Serve (FCFS)
Requests are processed in the order they arrive.
Simple and fair but inefficient if requests are scattered, leading to high seek time.
b) Shortest Seek Time First (SSTF)
Selects the request closest to the current disk head position.
Reduces average seek time but may lead to starvation for distant requests.
c) SCAN (Elevator Algorithm)
Moves in one direction, serving requests, then reverses direction upon reaching the end.
Provides fair access and avoids starvation but may have longer delays for some requests.
d) C-SCAN (Circular SCAN)
Similar to SCAN but moves in one direction and jumps back to the start after reaching the last request.
Ensures uniform wait times by avoiding bias toward one end of the disk.
e) LOOK and C-LOOK
Variations of SCAN and C-SCAN that stop at the last request instead of reaching the physical disk end.
More efficient than SCAN and C-SCAN since unnecessary movements are avoided.