Understanding File Subsystems and Disk Access
File Subsystem and Disk Access
The file subsystem is a part of the operating system responsible for ensuring each user has access to their files and programs and for ensuring the safety of these files by controlling access by other users.
- Field: A set of interrelated characters. Types: numeric, alphanumeric, Boolean, etc.
- Record: A set of fields relating to the same entity.
- File: A set of interrelated records.
- Database: Interrelated groups of files that are managed together.
- Key: A set of one or more fields that uniquely distinguish a record from all others.
Disk Access Planning
The speed of completing disk accesses will determine important aspects of overall system performance and the efficiency characteristics of user applications. The hardware of the disk must perform essentially three operations:
- Search: Move the arm (reader head) to find the proper track.
- Latency: Wait for the block to be placed in front of the read/write head.
- Transmission: Transmit the desired block.
The seek time and latency depend on the relative position of the block and the read/write heads at the time of the request. The transmission time is the same for all approaches.
Scheduling Algorithms
If more requests arrive while making access, the system must maintain a waiting list. After the current access is addressed, the disk will be released, and the system may decide the order in which to respond to pending requests, seeking to minimize the disk arm movement and, therefore, the service time of the request (total time).
- FCFS (First-Come, First-Served): Serves requests in order of arrival. Its programming is simple, and there is no significant overhead, but its effectiveness is relative.
- SSTF (Shortest Seek Time First): Prioritizes the request with the lowest seek time. This algorithm first attends to the request closest to the last one served or, in other words, the one that requires a smaller displacement of the arm. This algorithm is effective, but its way of accommodating requests can indefinitely defer some of them. The service speed for a request will vary depending on whether subsequent requests cause a postponement or not. This lack of prediction of disk access times makes the SSFT algorithm unsuitable for interactive systems due to the problem of indefinite postponement.
- SCAN: Handles requests closer in the direction of displacement.
- C-SCAN (Circular SCAN): Arm movement is the same as above, but it only serves requests in one direction. Upon reaching the last track (cylinder), it will return to the beginning without addressing any requests.
In practice, both in SCAN and C-SCAN, the disk arm does not reach the end but changes its meaning to serve the last request. These last two are the most appropriate algorithms for planning drives that will be heavily loaded.
File Subsystem Functions
Files are groups of interrelated information on which various operations can be performed: reading, writing, modification, etc. The system is responsible for performing these functions appropriately for the characteristics of the hardware used. The part of the OS responsible for these functions is often called the file subsystem, and its mission is to perform the following tasks:
- Storage Management: Deciding how to allocate space.
- Methods of Access.
- File Management: Managing the existing files.
- Protection and File Integrity: Ensuring integrity and privacy.