Organization of the file system
Assume that there is a large file containing a range of information about
students, consisting of records with several fields, and a challenge in
organizing quick search on one of the fields, such as the names of a student.
Method of allocating disk space with the help of index nodes used in a number of
operating system (Unix and a number of others, the following chapter) can serve
as an example to other organizations index.
In this case, OS uses a tree-organizing clusters, in which blocks that make up
the file are tree leaves, and each internal node contains pointers to the file
blocks are many. For large index files can be very large. In this case, create
an index for the index file (intermediate level of blocks or clusters of
indirect addressing). Operation to the files. The operating system must make
available to the user a set of operations to work with files sold through system
calls. More often than not, when dealing with the file the user is not one but
several operations. First, the need to find a data file and its attributes to
the symbolic name of his second, take the necessary attributes of the file in
the reserved area of RAM and analyze the user to perform the required operation.
Then perform the operation, followed by the release of the data file area
occupied by memory. Consider the example of the basic file operations Unix OS: ?
Create. Creating a file that contains no data. The essence of the call-announce
that the file exists and apply a number of attributes. ? Delete. Deleting a file
and the release of his employee disk space. ? Open. Before using a file should
open it. The purpose of the call system to allow the system to analyze the
attributes of the file and check access to the file, as well as take into RAM
blocks list of the file for quick access to its data. ? Close. If the work is
completed with the file, its attributes and address blocks on the disk are no
longer required. In this case, the file must be closed to free up space in the
interior tables file system. ? Seek. Enables specify the location of the file
where there will be reading (or record) data, that is to ask the current
position. ? Read. Reading data from the file. This usually happens with the
current position. Users should ask volume readable data buffer and provide for
them. ? Write. Writing data to a file from the current position. If the current
position is at the end of a file, its size is increased, otherwise entry is a
place available data, which thus lost. ? Get attributes. Provides processes they
need information on the attributes of a file. As an example, make utility, which
uses information on the last modification of files. ? Set attributes. Enables
user to install some attributes. The most obvious example is the installation of
a regime of access to the file.