Prerequisite – File System
The management of files and the management of device are interlinked with each other. Given below is an hierarchy used to perform the required functions of an I/O system efficiently.
The highest level module called Basic File System passes the information given to it to Logical File System, which in turn, notifies the Physical File System, that works with Device Manager.
Each level of the hierarchy is implemented using structured and modular programming, and the information is passed from higher positioned module to lower positioned module. Through this, they perform required services and continue the communication down the chain. The lowest level int his chain communicates with the physical device and interacts with the Device Manager.
Lets take an example-
Example: Read record number 17 from File X into Y:
X is the name of a direct access file previously opened for input and Y is the name of a data record previously defined within the program and occupying specific memory location.
As the file X has already been opened, the file directory has already been searched to verify the existence of the file. Relevant information about the file X has been brought into the Operating System’s active file table, and this information includes the the size of the file, the address of it’s first physical record, it’s protection and access control information.
This information is used by the Basic File System, which activates the Access Control Verification Module to verify if the user is permitted to perform this operation or not. If the user is permitted, then information and control is passed to Logical File System. If not permitted, the access is denied and the information and control are not passed.
The information passed down to the Logical File System is used to convert the record number into it’s byte address using the formula:
CBA = (RN - 1) * RL
This result and information is passed down to the Physical File System, which computes the location where the desired record would physically reside. If there are more than one record in that block, it will compute the offset of the record within that block using the formula:
block number = integers (byte address / physical block size) + address of first physical record offset = remainder (byte address / physical block size)
This information is passed onto the Device Interface Module, which transforms the block number to the actual cylinder/surface/record combination needed to retrieve the information from the physical storage device.
Once retrieved, device scheduling algorithm comes into play. The information is places in the buffer and control returns to the physical file system, which copies the information to the desired memory location.
Once finished, the message “All clear” is passed to all the modules. Any other command is handled the same way. At the point when the control reaches the device handler, the allocation module is called as it is responsible for keeping track of unused memory areas.
At each level of the file management system, the process of examining whether the request is valid or not occurs. First occurs at the directory level when the file system checks if the file exists or not. Next occurs when the access control verification module checks whether access is allowed or not. Next occurs when the logical file system checks if the requested byte is within the file’s limits. In the last the verification occurs when the device interface module checks if the storage device exists or not.
Thus, an operation of every user command needs the coordinated effort of every module of the file system.
Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.