Fig. 7.11. The physical organization of the file: continuous placement (a); List
of clusters (b); The list of indices (in); List numbers of clusters (g) The next
way to the physical organization of the file in the list of clusters of disk
storage space (Fig. 7.11, b). In this way at the beginning of each cluster
contains a pointer to the next cluster. In this case, the address information is
minimal: the location of the file can be one of the first cluster-room. Unlike
the previous method, each cluster can be added to the chain clusters of a file,
hence the fragmentation of clusters available. The file may change its size
during its existence, increased the number of clusters. The drawback is the
difficulty of access to arbitrarily set of file to read the fifth on a cluster
file must be read first four clusters, looking conversation numbers of clusters.
Furthermore, the method of data files contained in one cluster is not equal
degree pair (one word was spent on the number of the next cluster), and many
programs read data clusters, which is dvoyki degree. Popular method used, for
example, the FAT file system is the use of the list of indices (Figure 7.11 in).
This method is a modification of the previous one. The file also allocated
memory in the form of a list of clusters. Number of the first cluster remembered
in the directory entry stored characteristics of the file. The rest address
information is separated from the file clusters. Each cluster disk contact some
element index. Indices are in a separate area of the disk in this table MS-DOS
FAT (File Allocation Table), occupies a cluster. When memory is free, all
indexes are zeroed. If a cluster N appointed a file, the index of the cluster is
equal to a number of M next cluster the file, or has special significance as a
sign that the cluster is to file past. Index same previous cluster file
belittled N, pointing to the newly appointed cluster. In a physical organization
retains all the dignity of the previous method: minimum contact information, the
lack of fragmentation, the lack of problems with resizing. In addition, this
option has the additional advantage. First, access to random cluster file is not
required to read the clusters consistently enough to read only disk sectors
containing a table indexes, check your file on the number of clusters and the
number of chain desired cluster. Secondly, the data file is filled cluster, and
thus are of equal degree dvoyki. NOTE It should be noted that in the absence of
fragmentation in clusters on the disk still has a number of small memory size,
which can not be used, there is still fragmentation exists. These fragments are
unused part of the latest cluster, designated files, as a file is not in general
a multiple of the size of the cluster. Each file on average lost half of the
cluster. This is a big loss especially when the disc has a large number of small
files, and the cluster is large. The size of clusters depends on the size and
type of file system. Approximate range, which can change the cluster size,
ranging from 512 bytes to tens of kilobytes. Another way in which a physical
location of the file is a simple listing of clusters of rooms occupied by this
file (Figure 7.11 g). The list serves and address file. The disadvantage of this
method is clear: the length of the addresses depends on the file size and for
large file can be as much value. Merit is the same high speed access to random
cluster file, as there is a direct address, which precludes viewing chain
pointers in finding addresses of random cluster file. Fragmentation of clusters
in this way is also missing. The latter approach is used with some modifications
to traditional file systems and OS UNIX s5 ufs1. To reduce the amount of
targeted information direct way of addressing coupled with indirect. 1 Modern
versions of UNIX support and other types of file systems, including came from
other OS, such as FAT. The standard today for the UNIX file system ufs following
an addressing scheme used cluster file. To address file storage allocated 15
fields, each of which consists of 4 bytes (Figure 7.12). If the file size is
less than or equal to 12 clusters, the number of clusters directly to the first
twelve fields in the address. If the cluster size is 8 KB (maximum size of the
cluster supported in ufs), the way to address file sizes up to 98,304 bytes -
8192x12.
If the file size is more than 12 clusters, the next 13rd box contains the
address of the cluster, which can be located next cluster file numbers. Thus,
the 13rd element addresses used for indirect addressing. When the amount of 8 KB
cluster, which indicates the 13rd element can contain 2,048 rooms following
clusters data file and the file size may increase up to 8192 x (12 2048) =
16875520 bytes. If the file size is more than 12 +2048- 2060 clusters, use the
14 th field in which the number of clusters containing 2,048 rooms clusters,
each cluster of rooms to store 2048 data file. There is already a double -
indirect addressing. It can send files in clusters, with up to 8192 x (12 20482
2048) x10 = 3.43766 '° bytes. Finally, if the file contains over 12 20482 2048 =
4196364 clusters, then the last 15 th box to triple indirect addressing that
lets you specify the address file with the following maximum size: x 8192 (1912
2048 20482 20483) = 7.0403 h1013 bytes. Thus, ufs file system with a cluster of
8 KB files consisting of a maximum of 70 trillion bytes of data stored in
clusters 8 billion. As shown in Fig. 7.12, to specify the address of most major
file required: 15 items of 4 bytes (60 bytes) in the central part of the address,
plus one + (1) + (2048 1 2048 20482) 198403 = 4 cluster in indirect part address.
Despite the huge amount, the number is only about 0.05% of the volume addressed
to the data. Ufs file system supports disk clusters and smaller, with a maximum
file size will be different. Used in earlier versions of UNIX file system s5
addressing scheme is similar, but it is designed for smaller files, so it is
targeting 13 items instead of 15. Method listing addresses cluster file
activated and an NTFS file system used in Windows NT/2000. Here he completed a
natural reception, reduce the amount of targeted information: clusters are
addressed not file a continuous area, which consist of clusters of related disk.
Each area called the segment (run), or ekstentom (extent), is described by two
numbers: the number of primary cluster and the number of clusters in the stretch.
As for the reduction of operation time sharing OS trying to place a file in
consecutive clusters, so in most cases the number of consecutive field file will
be less than the number of clusters file and the official address information in
NTFS reduced compared with the scheme addressing ufs/s5 file systems. In order
to correctly decide on the allocation of a set of file clusters, file systems
must keep track of the status of all disk clusters: free / busy. This
information can be stored as separate files of targeted information, and along
with it. Physical organization FAT A logical partition, formatted by the FAT
file system consists of the following areas (Figure 7.13). Boot sector
includes primary program of operating system. Type of this program depends on
the type of operating system that will be taken from this section. Most copy
FA T provides information on the location of files and directories on disk.
Backup FAT. Root is a flat area the size of 32 sectors (16 KB), which allows
for the storage of 512 entries on the files and directories, because each entry
directory consists of 32 bytes. Area data is to keep all files and all
directories except the root. FAT file system supports only two types of files:
the usual file and directory. File system allocates memory only of the data, and
uses a minimum unit of disk space cluster. Table FAT (as the primary copy, and
backup) is a solid indicator index, which is equal to the number of clusters of
data. Between clusters and indicators index is mutually clear line-pointer with
zero-zero cluster, etc. Index index may have the following values characteristic
associated cluster: cluster is free (not used); using cluster file is not
the last cluster file; in this case, index index contains number of the next
cluster file; The latest cluster file; About defect cluster; a standby cluster.
Table FAT is common to all files section. In the original state (after
formatting), all of the clusters are free and all indications index (except
those used in the reserve and the defective units) are free to "cluster". When
viewing FAT file OS from the beginning, and is looking for the first free index
index. After its discovery in the directory entry number first "cluster" (see
Fig. 7.6, a) record number of the indicator. The cluster, the number of recorded
data file, it is the first cluster file. If the file is located in one cluster,
the index corresponding to the cluster, entered a special significance "last
cluster file." If the file size is more than one cluster, the OS continues to
view the FAT and looking for the next pointer to a free cluster. After its
discovery in the previous index recorded number of the cluster, which now
becomes the next cluster file. The process is repeated until no data will be
available every file. Thus a coherent list of all clusters file. In the initial
period following the format files will be placed in successive clusters of data,
but after a certain number of clusters Remove files one file at a random field
data, alternating with clusters of other files (Figure 7.14). Size FAT tables
and razryadnost used in the index indicator is the number of clusters in the
data. To minimize losses due to the fragmentation of clusters is desirable to
make small, and the reduction in targeted information and improve the exchange
rate rather than more, the better. In formatting the disk by the FAT file system
is usually chosen a compromise solution and the size of the clusters are
selected from the range of 1 to 128 sectors, or from 512 bytes to 64 KB.
Obviously, razryadnost index index shall be such that it can specify the maximum
number of clusters to drive volume. There are several varieties FAT different
razryadnostyu indicators index, which is used as a symbol: FAT12, FAT16 and
FAT32. In FAT12 file system used by 12-bit pointers, which support up to 4096
clusters in the data diska1 in FAT16, 16-bit pointers to 65,536 clusters and
FAT32-to 32-bit more than 4 billion clusters. one reality is the number slightly
lower as some index values pointer spent for identifying special situations,
such as the last cluster, "Neispolzuemy cluster", "Defektny cluster" and "contingency
" cluster.
|