Introduction to Operating Systems: Unit IV(b): File System

File Access Methods

File System - Introduction to Operating Systems

Information and data is kept in files. Files are stored on the secondary storage device. When this information is to be used, it has to be accessed and brought into primary main memory.

File Access Methods

• Information and data is kept in files. Files are stored on the secondary storage device. When this information is to be used, it has to be accessed and brought into primary main memory.

• Information in files could be accessed in many ways. It is usually dependent on an application. File organization checks how efficiently the input-output storage medium used.

File access method defines the way processes read and write files. Different access methods are available. Some operating systems provide only one access method and other systems provide many access methods.

1. Sequential access 2. Direct /Random access   3. Indexed sequential access.

• Access method means accesses to files that use a particular file organization are implemented by an input output control system.

Sequential Access Method

• Sequential access method simple method. The information in a file is accessed quentially one record after another.

• In this method, a process could read all the records in a file in order, starting at the beginning. It can not skip any records and can not read out of order.

• Fig. 6.2.1 shows sequential access method.

• Batch application uses sequential files. A byte stream file uses sequential access method.

• Example: Compiler and editor usually access files in this method. Transaction file is also example of sequential access method.

• Sequential file organization only method easily stored on tape and hard disk. Sequential access is best suited where most of the records in a file are to be processed.

Disadvantages:

It provides poor performances.

More efficient search technique is required.

Direct Access Method

It is also called random access method. This access allows a user to position the read/write mark before reading or writing.

• Fig. 6.2.2 shows direct method.

• Direct access file method provides, accessing the records directly. Direct access method is based on the hard disk that is a direct access device. It allows random access of any file block.

• Each record has its own address on the file with by the help of which it can be directly accessed for reading or writing. This feature is used by editors. An editors need to randomly access the contents of the file.

There is no restriction on the order of reading or writing for a direct access file. Operating system support is not required for direct access file.

• At the time of file creation, access method is defined. According to defined access method, file is accessed. Sequential access of a direct access file is possible but direct access of a sequential file is not.

Disadvantages:

1. Poor utilization of input-output device.

2. Consumes CPU time for record address calculation.

Indexed Sequential Access

• It is modified method of direct access method. This method is combination of direct and sequential access method.

• In simple indexed sequential method, simple single level of indexing is used. Sequential file is used as index.

• Fig. 6.2.3 shows indexed sequential file. Indexed sequential access contains key field and a pointer to the main file.

Indexed sequential files are store records in the order that they are written to the disk. Records may be retrieved in sequential order or in random order using an index to represent the record number in the file.

• If file size is large, larger index is required and it contains large number of entries. CPU takes time to search in to the index. Higher level index is used to reduce the search time. An entry in the higher level index points to a section of the index. This higher index contains the records. This index is searched to find the section sdns of the disk that may contains a required record.

• File system maintains an overflow file. It adds new records to an overflow file. The record in the main file that immediately precedes the new record in logical sequence is updated to contain pointer to the new record in the overflow file.

 The overflow file is merged with the main file during a batch update. The multiple indexes for the same key field can be set up to increase efficiency.

The lowest level of index file is treated as a sequential file and a higher level index file is created for that file. Higher index file would contain pointers to lower index files, which would point to the actual data items.


University Questions

1. Discuss about the various file access methods.

2. Describe about the Sequential and Direct Access methods of information from a file.

Introduction to Operating Systems: Unit IV(b): File System : Tag: : File System - Introduction to Operating Systems - File Access Methods