Wednesday, April 22, 2009

Direct-Access Organization

In direct-access file organization, records are placed randomly throughout the file. Records need not be in sequence because they are updated directly and rewritten back in the same location. New records are added at the end of the file or inserted in specific locations based on software commands.

Records are accessed by addresses that specify their disk locations. An address is required for locating a record, for linking records, or for establishing relationships. Addresses are of two types: absolute and relative. An absolute address represents the physical location of the record. It is usually stated in the format of sector/track/record number. For example, 3/14/6 means go to sector 3, track 14 of that sector, and the sixth record of the track. One problem with absolute addresses is that they become invalid when the file that contains the records is relocated on the disk. One way around this is to use pointers for the updated records.

A relative address gives a record location relative to the beginning of the file. There must be fixed-length records for reference. Another way of locating a record is by the number of bytes it is from the beginning of the file. Unlike relative addressing, if the file is moved, pointers need not be updated, because the relative location of the record remains the same regardless of the file location.

Each file organization method has advantages and limitations; a summary is given in. Payroll is a good example. The system goes through the employee list, extracts the information, and prepares pay slips. There are no lengthy random-access seeks. In contrast, real-time applications where response requirements are measured in seconds are candidates for random-access design. Systems for answering inquiries, booking airlines or stadium seats, updating checking or savings accounts in a bank, or interacting with a terminal are examples for random-access design.

No comments:

Post a Comment