Anonymous

Describe Direct Access Methods To Access Information In A File?

1

1 Answers

Muhammad Azhar Profile
Muhammad Azhar answered
Direct access is based on a disk model of a file. For direct access, the file is viewed as a numbered sequence of block or records. A direct-access file permits random blocks to be read or written. After block 18 has been read, block 57 could be next and then block 3. There are no restrictions on the order of reading and writing for a direct access file. Direct access files are of great use for intermediate access to large amounts of information.
The file operations must be modified to include the block number as a parameter. It works like "read n", where n is the block number rather than "read next". Similarly, it writes with "write, n" rather that "write next".

An alternative approach retains "read next" and "write next". It adds an operation "position file to n" where n is the block number. Then we would issue the command "position to n" and then "read next".

All operating systems maintain sequential as well as direct access for files. Some systems allow only sequential file access. Others allow only direct access. Some systems require that a file should be defined as sequential or direct when it is created. Such a file can be accessed only in a manner defined at the time of its declaration.

Answer Question

Anonymous