File logical structure

Definition

The logical structure of the file is a user-visible structure. Logical files are structured into two forms:

One is an unstructured streaming file, which means that the information in the file is no longer divided into units, and it is a file composed of a sequence of character streams.

One type is a structured record file, in which the user divides the information in the file into logically independent units of information, and each unit is called a logical record (record for short).

All records usually describe an entity set and have the same or different numbers of data items. The length of the records can be divided into two types: fixed-length and variable-length records.

When designing the file system, which logical structure should be selected to be more conducive to the user’s operation of the file information?

Under normal circumstances, the logical structure of the selected file should be Follow the following principles:

(1) When users modify file information, the given logical structure should minimize the changes to the stored file information.

(2) When users need to operate on file information, the given logical structure should enable the file system to find the record or basic information unit that needs to be found in the shortest possible time.

(3) The file information should occupy the smallest storage space.

(4) It should be easy for users to operate.

Obviously, for unstructured files with character streams, it is more difficult to find the basic information unit in the file, such as a certain word. But conversely, the unstructured file management of the character stream is simple, and the user can conveniently operate it. Therefore, those files that do not operate much on the basic information unit are more suitable for the unstructured way of using character streams, for example, source program files, object code files, and so on. In addition to the unstructured way of character streams, record-type structured files can arrange the records in the file in various ways to form different logical structures, so that users can modify, append, search and manage the records in the file. And so on.

A record is an information unit with a specific meaning, which is composed of a set of keys, attributes and attribute values ​​corresponding to the logical address (relative position) of the record in the file and the record name.

Figure 1 shows an example of the composition of a record. In Figure 1, 1296 is the logical address of the record named R in the file,'name: A'is the key of the record, and'sex','birth date','salary', etc. are the attributes of the record, Immediately after these are the attribute values. A record can have multiple key names, and each key name can correspond to multiple attributes. Furthermore, according to the requirements of each system design, the record can be of fixed length or variable length. The length of the record can be as short as one character or as long as a file, which should be determined by the system designer.

Common types

(1) Continuous structure (2) Multiple structure (3) Transposed structure (4) Sequence structure

Related Articles
TOP