next up previous
Next: Physical Representation Up: File Management Previous: Naming

Access Methods

An access method defines the way processes read and write files. We study some of these below.

Sequential Access

Under this access method, the entire file is read or written from the beginning to the end sequentially. Files in popular programming languages such as Pascal and Ada provide such access. The file is associated with a read/write mark, which is advanced on each access. If several processes are reading or writing from the same file, then the system may define one read/write mark or several. In the former case, the read/write mark is kept at a central place, while in the latter case it is kept with the process table entry. In Unix, a combination of the two schemes is provided, as we shall see later.

Direct Access

This access allows a user to position the read/write mark before reading or writing. This feature is useful for applications such as editors that need to randomly access the contents of the file.

Mapped Access

The Multics operating systems provide a novel form of access which we shall call mapped access. When a process opens a file, it is mapped to a segment. The open call returns the number of this segment. The process can thus access the file as part of its virtual store. The CloseSegment call may be used to close the file.

Structured Files

So far, we have treated files as byte streams. Database applications often wish to treat them as records, that may be accessed by some key. To accommodate these applications, some systems support typed or structured files that are considered streams of records. If a file is structured, the owner of the file describes the records of the file and the fields to be used as keys. OS/360 for IBM computers and DEC VMS provide such files.

Binding of Access Methods

An access method may be specified at various times:

When the operating system is designed. In this case, all files use the same method.

When the file is created. Thus, every time the file is opened, the same access method will be used.

When the file is opened. Several processes can have the same file open and access it differently.

next up previous
Next: Physical Representation Up: File Management Previous: Naming

Prasun Dewan
Wed Apr 21 11:44:11 EDT 1999