File structure (excerpt)

xiaoxiao2021-03-06  65

File Structure (Excerpt) When the user uses the order in order to use the order in order, the user always accesses one of the logical records, that is, after the I have access to the i-th record, next time I always access the i 1 record. . Therefore, when the user accesses the file in order to access the file, as long as the access requirement (read or writes) is given, the record number to be accessed is not required.

In order to adapt order access, the storage structure of the file can use sequential files or link files. Since the sequential file must take up a continuous storage space, in order to improve the utilization of the storage space, the structure of the link file is generally employed in the case where the user accesses the file in the logical recording order. Link files can be stored in discontinuous physical blocks, using the link word (also known as pointer) to point out the association between the individual physical blocks in the file. In general, the first physical block number of the link file is registered in the file directory, set a link word in each block, pointing out the next physical block number of the link file, the last piece of the link word is "0", Indicates the end of the file. The link file structure is shown in Figure 7-1.

Figure 7-1 The link file structure uses the above-described link file structure, only after reading a physical block information, can be known from the link word to the next physical block number. So, when the user wants to insert some information in the file, the file system must request the launch disk readout information multiple times to do insertion. The MS-DOS operating system improves the link file structure, which is set together all link pointers, stored in the file positioning table FAT. You don't have to read the physical block information directly from the FAT when you look for the link. Its design ideas are: assume that there is a total of N physical blocks on the disk for use, and FAT has n items. When it is initialized, it is full "0", indicating that the corresponding physical block can be used, when you want to store the file, look for from FAT For "0", its corresponding physical block is used to store file information, register with the link pointer of the file in FAT, and the first block number of the file is registered in the file directory. E.g:

Figure 7-2 File Location Table FAT

The first two items of FAT in MS-DOS are used to record the type of disk. Article 2 denotes a distribution and link of the disc, and in the third item, "0 indicates the corresponding third block. Figure 7-2 also pointed out that file a sequentially stored in 2, 4, 20, 21 In the 45, 46 blocks, the pointer indicates the end of the file when the pointer is FFF.

It can be seen that the FAT of MS-DOS has two effects: one is to play the role of the bit, which blocks can be occupied, which blocks are idle; second, it means the link of the file.

转载请注明原文地址:https://www.9cbs.com/read-90550.html

New Post(0)