3What is a Basic File System? A Basic File System (BFS) is the only software that interfaces directly with the peripheral devices attached to the system. The function of a basic file system is sometimes referred to as physical I/O. This is because it deals with the physical reading and writing of blocks of data on the peripheral devices. However, the BFS does not understand the content and meaning of the data being transferred.
4Why Basic File System?Users and computer systems need a BFS for the following reasons:To provide a common interface to perform block I/O.To provide a centralized control program to ensure that the devices connected to the system are being allocated and scheduled properly.To provide a central resource to ensure data integrity by providing error recovery and exception handling for all users.
6Sources of File System inputs? The data the BFS needs to perform its work must come from one of the following sources:User ProgramsCommand Language FilesJob Control Languages(JCL), utilized at the user’s site a stand-alone utility program that interactively request the data from the userSuch a program can prompt the user for each of the required parameters, check inputs for validity, and then store the information within the file itself.
8Sources of File System inputs? The BFS controls the following system resources to guarantee the integrity of the user’s data:
9Basic File System Functions The allocation of all space on the devicesThe centralization of all I/O through the BFSThe control of the devices themselves, which usually requires a rather detailed knowledge of device-specific details.The processing of all the I/O terminations to ensure that the correct processing is performed. Also, it must then initiate the next I/O request targeted for that device.Finally, upon completion of the user’s I/O request, the BFS must notify the user as to whether the I/O request completed correctly. This is done by returning a status field, which indicates how the I/O request terminated.
10Basic File System Operations Most programs will perform the following kinds of functions:File OperationsCREATE new filesOPEN, or start using, a file that was created prior to the running of this program.Increase the size of the file (EXTEND), if and when the file has exhausted the current allocated space.Stop using (CLOSE) the file after the program has finished using it.DELETE a file that already exists.Block Data Transfer operation: transfer data from (READ) or to (WRITE) the device designated by the program.
12File Operations – Create File Request Allow all users to create new files whenever it is necessaryThe following data are needed to create a file:Device/user name: tells where to place the file when it is created.Filename identifies the file among all the other files in the computer system.File size tell how much room to allocate when it is creating the fileFile organization needed so that the file system, or more specifically the access methods, can know how to insert and later retrieve the blocks within the fileBlock size amount of data that will be read or written in every I/O operation.
13File Operations – Create File Request - Tasks Validate the User’s Input DataCheck to see if the file already existsAllocate space on the medium for the file:The BFS can tell if enough space exists by comparing the projected file size, from the vantage point of the user, against the device allocation table on the target device. If there is not enough space on the medium, the BFS has no choice but to abort its processing.Insert a pointer to the first block allocated to the fileAllocate and initialize I/O buffers and control blocks
14File Operations – Create File Request - Tasks First, it must allocate space in memory large enough of READ in the largest block in the file. The blocks of memory, which are dedicated to the transferring of the data from memory to and from the peripheral devices, are called I/O buffers.Next, the BFS must allocate and build a table, also known as a file control block, in which the critical information about the file will be saved.Return success or fail status back to the user.
15File Operations – Create File - Errors Possible CREATE errors are:Another file with the same name already exists.The device has no available space to create another new file.The device is, or has become, nonoperational.There was a hardware problem which aborted the processingOne or more of the input parameters given to the BFS were wrong.
16File Operations – Open File Request OPEN request is allow users to locate and access files that were created at an earlier time.The information is different from the list of information required to create a file. The reason for this is that all of the critical pieces of data which really describe the file were written out into the file structure during the CREATE processing.Required Information:Device nameUser name, or account identificationFilename
17File Operations – Open File- Task The tasks for processing an OPEN file command are:Allocate space for Internal Control Blocks (ICB)Get the correct volumes mounted on the devicesLocate the file on the devicesAllocate internal memory space for I/O buffersProtect against unauthorized usersMaintain a list of all the open file in the system
18File Operations – Open File- Errors For the OPEN file command, we could encounter the following errors:File not found on the specified device and in the specified user account or directory. This could be because of an incorrectly specified filename or device identifier.File already in use by some other user application.Hardware error has occurred from which the BFS could not recover.
19File Operations – Extend File The purpose of the EXTEND file function is to allow the user(s) to explicitly increase the size of a file.What information will the BFS need to increase the size of a file for the user?Device and directory name where the file is locatedName of the fileAmount by which the file should be increased in size.
20File Operations – Extend File - Tasks The work must be done as follows:Validate the parameters in this requestCheck to see if there is enough room on this device to increase the size of the file by the requested amount.If space exists, take the space from the medium’s general space pool, and mark it in such a way that no other user can take this space.Add the space to the file in question, and to the internal information kept on the file, so that can be correctly processed at a later date.Return a success or failure status code to the user.
21File Operations – Extend File - Errors Errors from the EXTEND request:Device has no space available in which to extend the fileFile was not previously OPENed, indicating that the user has inadvertently gotten the sequence of I/O processing out of order.
22File Operations – Close File The purpose of a CLOSE file function is to allow the user todecrease,stop using the file,thereby allowing other users to access the file.To perform this function the BFS need only know:the name of the file to be closed.To perform a CLOSE file request, the BFS requires only an indication of which currently open file is to be Closed.
23File Operations – Close Tasks it can perform the processing as follows:Write out any I/O buffers that have been modified and are still in main memory but which have not yet been written out to the specified deviceWrite out any updated information about the file that would be useful or required to know in the future in order to process the file correctly.Release any internal memory space dedicated to the processing of that particular file.Return status to the user, indicating success or failure.
24File Operations – Close Errors The following exception conditions can arise during the processing of the CLOSE function:The file to be closed was not currently openAny of the errors that can occur on a WRITE operation could occur, since we are writing blocks back into the fileA hardware problem could occur that could abort the CLOSE processing.
25File Operations – Delete File The function of the DELETE file request is to erase or get rid of a specific file from the system. This occurs when the user no longer needs a particular file and wishes to reuse the file space from some other purpose.The following information is required:Device and user account nameFile name
26File Operations – Delete File - tasks To delete a file from the system, the following tasks must be performed:Validate the user’s input parametersReturn all the space on the media taken up by the file to the space pool on the mediaRemove the file name from the directory where it resides.Return status to the user.
27File Operations – Delete File - Erors Any of the following errors could occur:File could not be found, either because of an invalid file or user account name.Other users were currently active on the fileA hardware problem was detected.
29Block OperationA block of data is the unit of data that is transferred to, or from, a device.The amount of data (i.e., size of the block) is definable by the user. The larger the block, the more data that will be transferred in that I/O operation and the greater the performance of the program.This is true but must be taken from the perspective that the memory resources required to hold these blocks of data is not unlimited and should be considered to be a scarce commodity.
30Block Operation – Write Request The purpose of the WRITE function is:Provide users with the capability of transferring data out of the computer’s main memory and onto one of the devices connected to the system.The information required consists of the following data:Number of the block to be writtenAddress of the I/O buffer in many memory that contains the block to be writtenSize or amount of the block to be writtenName of the status field into which the file system will insert the termination status of the I/O request.
31Block Operation – Write Request - Tasks The WRITE routine must perform the following tasks as part of the job of processing the request:Validate the input parametersConvert the logical block number to a physical device addressCheck if space exists in the file for this blockIf space exists, execute the WRITE I/O operation to the device. Reset the buffer-modified flag for that specific I/O buffer, since that block has now been written out to the device.If space does not exist in the file, extend the file. This is called an implicit extend to the
32Block Operation – Write Request - Tasks Some of the errors that can occur while performing a WRITE operation are:No space available for the operation to completeHardware unrecoverable error has occurredMismatch from READ after WRITE validation sequence.
33Block Operation – Read Request The function of the READ routine is to transfer a specific block of data from the medium into main memory. The unit of data transfer is the block.The information required to process the read request is as follows:Number of the block to be read into memoryAddress of the I/O block buffer in main memory into which the block will be readSize or amount of data to be read into main memoryThe address of a field into which the file system can store the status of the I/O request
34Block Operation – Read Request - Tasks The READ request performs exactly the opposite function to that of the WRITE request. The steps are:Validate input parametersConvert the logical block number to a physical blockRead the block into an I/O buffer in main memoryReturn status to the user program
35Block Operation – Read Request - Errors Some of the possible errors that can be encountered on READ operations are:Read error detected by the deviceInvalid device block number requestedHardware failure detected