This preview shows page 1. Sign up to view the full content.
Unformatted text preview: of the order in which the bytes or records are stored. For example, in a
record-oriented file, a specific record can be directly accessed by specifying the
value of its key field, rather than reading the records one-by-one from the
beginning and comparing its key field value with the value of the key field of the
desired record till the desired record is found. Similarly, in a byte-oriented file, it
is possible to directly go to the n th byte of the file without the need to read all the
(n-1) bytes before it.
Random access files are essential for many applications. For example, in a railway
reservation system, the information about all the tickets booked on a particular
train may be stored in a single file. If a customer wants to cancel an already
booked seat, the reservation program must be able to access the specific record for
that seat without having to read the records for hundreds of other booked seats
first, so that the booking service can be fast enough.
All operating systems do not support both sequential and random access files.
Some support only sequential access files, some support only random access files,
while there are some which support both. Those, which support files of both types,
normally require that a file be declared as sequential or random when it is created;
such a file can be accessed only in a manner consistent with its declaration. Most
modern operating system support only random access files.
An operating system provides a set of operations to deal with files and their
contents. A typical set of file operations provided by an operating system may be
as follows (the actual set varies from one operating system to another):
1. Create. Is used to create a new file.
2. Delete. Is used to delete an existing file that is no longer needed.
3. Open. An already existing file must be opened before using it. This operation
is used to open an existing file when a user wants to start using it.
4. Close. When a user has finished using a file...
View Full Document
- Spring '14