View the hierarchical structure of the disk c. Hierarchical structure of the file system. Commands for working with files and directories
Working with files is a very important type of computer work. Everything is stored in files: both software and information necessary for the user. With files, as with business papers, you constantly have to do something: copy them from one medium to another, destroy unnecessary ones, create new ones, search for them, rename them, put them in one order or another, etc.
To clarify the meaning of the concept of a file, it is convenient to use the following analogy: the storage medium itself (for example, a disk) is like a book. We talked about the fact that a book is the external memory of a person, and a magnetic disk is the external memory of a computer. The book consists of chapters (stories, sections), each of which has a title. The files also have their own names. These are called file names. At the beginning or end of a book there is usually a table of contents - a list of chapter titles. There is also such a directory list on the disk containing the names of the stored files.
You can display the directory to see if the file you need is on the drive.
Each file stores a separate information object: a document, an article, a numeric array, a program, etc. The information contained in the file becomes active, i.e., can be processed by a computer, only after it is loaded into RAM.
To find the required file, the user must know: a) what the file name is; b) where the file is stored.
File name
Here is an example of a file name* (* The following examples are focused on the rules adopted in Microsoft operating systems: MS-DOS and Windows. Linux OS applications are also illustrated.):
To the left of the dot is the actual file name (myprog). The part of the name (pas) following the dot is called file extension. Usually Latin letters and numbers are used in file names. In addition, the file name may not have an extension. In the Microsoft Windows operating system, Russian letters are allowed in file names; The maximum name length is 255 characters.
The extension indicates what kind of information is stored in this file. For example, the txt extension usually denotes a text file (contains text), the px extension - a graphic file (contains a picture), zip or gag - an archive file (contains an archive - compressed information), pas - a program in Pascal.
Logical drives
One computer can have several disk drives - devices for working with disks. Often on a personal computer, a large-capacity hard drive built into the system unit is divided into sections. Each of these partitions is called a logical disk and is assigned a one-letter name (followed by a colon) C:, D:, E:, etc. The names A: and B: usually refer to small-capacity removable disks - floppy disks (floppy disks) . They can also be considered as names of logical disks, each of which completely occupies a real (physical) disk* (* On modern PC models, floppy magnetic disks have fallen out of use.). Therefore, A:, B:, C:, D: are all names of logical drives.
The optical drive is assigned the next alphabetical name after the name of the last partition on the hard drive. For example, if your hard drive has partitions C: and D:, then the name E: will be assigned to the optical drive. And when you connect flash memory, another drive F: will appear in the list of logical drives.
The name of the logical drive containing the file is the first "coordinate" that determines the location of the file.
Disk file structure
Modern operating systems support multi-level organization of files on external memory disk devices - hierarchical file structure. To facilitate understanding of this issue, we will use an analogy with the traditional “paper” method of storing information. In this analogy, a file is represented as some titled document (text, drawing) on paper sheets. The next element of the file structure is called catalog. Continuing the “paper” analogy, we will think of a directory as a folder into which you can attach many documents, i.e. files. The directory also gets its own name (think of it on the cover of a folder).
The directory itself can be part of another directory external to it. This is similar to nesting a folder inside another larger folder. Thus, each directory can contain many files and subdirectories (called subdirectories). The top-level directory that is not nested within any other directory is called the root directory.
In the Windows operating system, the term “folder” is used to refer to the concept of “directory”.
A graphical representation of a hierarchical file structure is called tree.
In a tree, the root directory is usually represented by the symbol \. In Figure 2.10, directory names are written in capital letters, and file names are written in lowercase letters. Here in the root directory there are two folders: IVANOV and PETROV and one file fin.com. The IVANOV folder contains two subfolders PROGS and DATA. The DATA folder is empty; there are three files in the PROGS folder, etc.
File path
Now imagine that you need to find a specific document. To do this in the “paper” version, you need to know the box in which it is located, as well as the “path” to the document inside the box: the entire sequence of folders that need to be opened to get to the papers you are looking for.
To find a file on a computer, you need to know the logical drive on which the file is located and the path to the file on the drive, which determines the location of the file on that drive. The path to a file is a sequence of directory names, starting from the root directory and ending with the one in which the file is directly stored. Here is the familiar fairy-tale analogy of the concept of “path to file”: “There is a chest hanging on an oak tree, in the chest there is a hare, in the hare there is a duck, in the duck there is an egg, in the egg there is a needle, at the end of which is Koshcheev’s death.”
Finally, you need to know the file name. The logical drive name, file path and file name written down in sequence make up full file name.
If shown in Fig. 2.10 file structure is stored on the C: drive, then the full names of some of the files included in it in the symbolism of the Microsoft Windows operating system look like this:
C:\IVANOV\PROGS\progl.pas
C:\PETROV\DATA\task.dat
Viewing the file structure
The operating system provides the user with the ability to view the contents of directories (folders) on the screen.
Information about the file structure of a disk is contained on the same disk in the form of a file allocation table. Using the OS file system, the user can sequentially view the contents of directories (folders) on the screen, moving down or up the file structure tree.
Figure 2.11 shows an example of how a directory tree is displayed on a computer screen in Windows.
The right window shows the contents of the ARCON folder. This is a lot of files of different types. Hence, for example, it is clear that the full name of the first file in the list is as follows:
E:\GAME\GAMES\ARCON\dos4gw.exe
From the table you can get additional information about the files. For example, the file dos4gw.exe is 254,556 bytes in size and was created on May 31, 1994, at 2:00 a.m.
Having found an entry about the desired file in such a list, using OS commands, the user can perform various actions with the file: execute the program contained in the file; delete, rename, copy file. You will learn how to perform all these operations in a practical lesson.
Briefly about the main thing
A file is a named area of the computer's external memory.
All necessary actions on files are provided by the operating system.
The file name consists of the actual name and extension. The extension indicates the type of information in the file (file type).
Hierarchical file structure is a multi-level organization of files on disks.
A directory is a named list of files and subdirectories (subdirectories). The top-level directory is called the root directory. It is not nested in any directories.
The full file name consists of the logical drive name, the path to the file on the drive, and the file name.
Questions and tasks
1. What is the name of the operating system used in your computer lab?
2. How many physical drives do your computers have? How many logical disks are there on physical disks and what names do they have in the operating system?
3. What rules govern file names in your OS?
4. What is the path to the file on the disk, the full file name?
5. Learn (under the guidance of a teacher) to view disk directories on your computers on the screen.
6. Learn to initialize programs from program files (such as exe, sot).
7. Learn to perform basic file operations in the operating system you are using (copying, moving, deleting, renaming files).
EC TsOR: Part 1, chapter 2, § 11. TsOR No. 1,9.
User Interface
Main topics of the paragraph:
■ friendly user interface;
■object-oriented interface; objects;
■ context menu.
Arkhangelsk State University
Kotlas branch
full-time department
Faculty: technical
Specialty: PGS
Coursework
Discipline: computer science
Topic: Disk File Structure
Completed
1st year student
Zhubreva Olga
Alexandrovna
Checked:
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
§ 1 The concept of a file system. . . . . . . . . . . . . . . . . . . .
§ 2 MS-DOS file system. . . . . . . . . . . . . . . . . . . .
§ 3 File system Windows 95. . . . . . . . . . . . . . . . . .
§ 4 Windows NT file system. . . . . . . . . . . . . . . . . .
Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction.
The methodological manual reveals the essence of the concept of “file system”,
which is one of the most important concepts in the course “Software
computer support”, and also presents the structure of file systems of such
operating systems such as MS-DOS, Windows 95, Windows NT.
The structure of the present is determined by an attempt to achieve this goal.
manuals: the topic material is divided into 4 main parts (parts are presented in
form of a paragraph), each of the parts is also, as necessary, divided into
smaller detailed parts.
§ 1 The concept of a file system.
1.1. File system definition.
File (in English File) - folder, folder.
A file is a named area of memory on some physical
a medium intended for storing information.
A set of operating system tools that provide access to
information on external media is called a file management system or
file system.
File system is a functional part of the operating system.
system that is responsible for exchanging data with external storage
devices.
ORGANIZING ACCESS TO THE FILE
Directory structure
We hope that you have a good idea of organizing the storage of books in
library and, accordingly, the procedure for searching for the desired book by its code from
catalogue. Transfer your understanding of this to the way you store files
on the disk and organizing access to it.
Access - the procedure for establishing communication with memory and a file located in it
for writing and reading data.
The name of the logical drive that appears before the file name in the specification,
specifies the logical drive on which to search for the file. On the same disk
a directory is organized in which the full names of the files, as well as their
characteristics: date and time of creation;
volume (in bytes); special attributes. Similar to the library system
directory organization the full name of the file registered in the directory,
will serve as a cipher by which the operating system finds
location of the file on disk.
Directory - a directory of files indicating their location on the disk.
There are two directory states - current (active) and passive. MS
DOS remembers the current directory on each logical drive.
The current (active) directory is the directory in which the user is working
produced in current machine time.
Passive directory - a directory that is not currently available
The MS DOS operating system adopts a hierarchical structure
(Fig. 9.1) directory organization. Each disk always has
a single main (root) directory. He is at level 0
hierarchical structure and is indicated by the symbol "\". Root directory
created when formatting (initializing, marking) a disk, has
limited in size and cannot be deleted using DOS tools. To main
directory may include other directories and files that are created by commands
operating system and can be removed using the appropriate commands.
Rice. 9.1. Hierarchical directory organization structure
Parent directory is a directory that has subdirectories. Subdirectory
A directory that is included in another directory.
So any directory containing lower level directories can
to be, on the one hand, parental towards them, and on the other hand,
subordinate to the top-level directory. As a rule, if this
does not cause confusion, use the term "catalogue" to mean either
subdirectory, or parent directory depending on the context.
Directories on disks are organized as system files. The only thing
the exception is the root directory, for which a fixed space is allocated on
disk. Directories can be accessed as if they were a regular file.
Note. The directory structure may contain directories that are not
The names of subdirectories are the same as the rules for naming files (see.
subsection 9.1). For formal differences from files, usually subdirectories
assign only names, although you can add a type according to the same rules as
and for files.
Access to the file contents is organized from the main directory, through
a chain of subordinate directories (subdirectories) of the i-th level. In the catalog
records of both files and directories can be stored at any level
lower level. are called empty.
In Fig. 9.2 shows the simplest directory structure, where in the main
directory 0
level only records about files of lower-level directories are stored
doesn't exist
In Fig. Figure 9.3 shows the hierarchical structure of the directory, where in the directories
any level stores records about files and directories at the lower level. Moreover
transition to a lower-level directory can only be organized
sequentially through subordinate directories.
Rice. 9.2. Simplest directory structure with no directories
lower level
Rice. 93,.. Typical directory structure consisting of lower directories
level: when designating a lower level directory, three numbers are used:
the first digit indicates the level number; the second is the serial number of this
directory at a given level, the third indicates at what level
his name is registered. Each directory has a KAT name with indexes.
For example, CAT342 is the name of a third-level directory that is registered in
second level catalog number 4
You cannot go from the main directory directly to a directory, for example, level 5.
It is imperative to go through all the previous top-level directories.
The principle described above for organizing access to a file through a directory
is the basis of the file system.
The file system is the part of the operating system that manages the location and
access to files and directories on the disk.
The concept of a disk file structure is closely related to the concept of a file system.
by which we mean how they are located on the disk: the main directory,
subdirectories, files, operating system, and which ones are allocated for them
volumes of sectors, clusters, tracks.
Rules for forming the disk file structure. When creating a file
disk structure, the MS DOS operating system follows a number of rules:
A file or directory can be registered with the same name in
different directories, but in the same directory only once;
The order of file names and subdirectories in the parent directory
arbitrary;
The file can be divided into several parts, for which
sections of disk space of the same volume on different tracks and
sectors.
Path and invitation
From Fig. 9.1 - 9.3 you can see that the file is accessed through the directory
thanks to the name of this file registered in it. If the directory has
hierarchical structure, then the operating system organizes access to the file
depending on the position of the subdirectory in which the name is registered
the file you are looking for.
Access to the file can be organized as follows:
If the file name is registered in the current directory, then it is sufficient for
to access a file, specify only its name;
If the file name is registered in a passive directory, then, while in
current directory, you must specify the path, i.e. chain of subordinates
directories through which the file should be accessed.
Path is a chain of subordinate directories that must be traversed along
hierarchical structure to the directory where the desired file is registered. At
When specifying a path, directory names are written in order and separated
separated from each other by the \ symbol.
User interaction with the operating system is carried out with
using the command line displayed on the display screen. At the beginning
The command line always has a prompt that ends with
>. The prompt may display: the name of the current drive, the name of the current
directory, current time and date, path, delimiter characters.
The operating system prompt is an indication on the information display screen,
indicating the operating system is ready to input user commands.
Example 9.8.
The current drive is floppy drive A.
the current directory is the main directory, as indicated by the \ symbol.
C:\CAT1\CAT2
The current drive is hard drive C. The current directory is
second level catalog CAT2, included in the first level catalog
CAT1, which, in turn, is registered in the main
catalogue.
There are three options for organizing the file access path, depending on
places of its registration:
The file is in the current directory (no path). When organizing
To access a file, you just need to specify its full name;
The file is located in a passive directory of one of the lower levels,
subordinate to the current directory. When organizing access to a file
you must specify a path that lists all directory names
lower level lying on this path (including the directory in which
this file is registered);
the file is in a passive directory on a different branch from
the location of the current directory of the hierarchical structure. At
to organize access to the file, you must specify the path starting with
main directory, i.e. starting with the \ character. This is explained by the fact that in
hierarchical structure, movement is possible only vertically from above -
Horizontal transitions from directory to directory are not allowed.B
The following examples illustrate possible path options.
Example 9.9.
Condition: file F1.TXT is registered in the current 1st level directory K1
hard drive C. Therefore, the prompt C:\K1 is displayed on the screen
Explanation: In this case there is no path and to access the file it is enough
indicate only its full name F1.TXT
Example 9.10.
Condition: file F1.TXT is registered in the 2nd level directory K2 hard
drive C. The current directory is K1. Therefore, an invitation is displayed on the screen
Explanation: in this case the path will start from the directory
K1 down through its subordinate directory K2. Therefore, before
The full file name indicates the path from the current K2 directory
Having become familiar with the concept of a path, let us return to what was introduced in subsection. 9.1
the concept of a file specification. There is a shortened file specification and
the complete file specification that the path participates in. In Fig.
Figure 9.4 shows options for the rule for generating a file specification.
Rice. 9.4. Specification formats (optional parameter specified)
Example 9.12. Short form of the file specification C:\KIT.BAS
The file with the BASIC program KIT.BAS is located in the main
hard drive directory.
Full form file specification
C:\CAT1\CAT2\BOOC1.TXT
The text file BOOOK1.ТХТ is registered in the directory of the second
CAT2 level of hard drive C.
Structure of directory entries
Now you have to get acquainted with the structure of the records stored in the directory
with information about lower-level files and subdirectories.
A file entry in a directory contains the name and type of the file, the file size in
bytes, creation date, creation time and a number of other parameters required
operating system to organize access.
The entry for a lower-level subdirectory in the parent directory contains it
name, attribute, date and time of creation.
Let's consider possible options for the contents of the directory. 1st option. In the catalog
Only records about files are stored (Fig. 9.5). Before the file entries
A message about the directory name is displayed. In this case, this is the main
floppy disk directory A. At the end of the directory contents, a message appears about
the number of files stored on the disk and the free disk space in
bytes For example, the directory above displays the following message:
4 file(s) 359560 bytes free
Number of files on disk. Volume of free
disk space, byte2nd option.
The directory stores only entries about lower-level directories (Fig. 9.6).
Rice. 9.7. The main directory stores files and subdirectories
At the end of the directory, as in the previous case, you will see a similar
The above-mentioned entry about the amount of free disk space.
3rd option: The directory stores records of both files and directories
lower level (Fig. 9.7). From this structure it is clear that in this directory
there are 3 files and 2 lower level directories BASIC and LEXICON. On disk
free space 2.6575 MB.
The three directory presentation options discussed above reflect the contents of
main directory. Directory structure, starting from level 1 and below,
identical and differs from the main one only in that before the file entries
and lower-level directories, two entries with an ellipsis are placed (Fig. 9.8).
The dots you see at the beginning mean that the content is called up on the screen
subdirectory (1st level directory) KNIGA, which contains two text
SVET and TON files.
|Directory of C:\KNIGA | | |
| |11-12-90 |09:40 |
| |10-10-91 |08:30 |
|svet txt 55700 |04-04-90 |10:05 |
|ton txt 60300 |03-05-91 |11:20 |
|2 files 912348 bytes free | | |
|Fig. 9.8. Structure of entries in a subdirectory |
1.2. File system FAT.
Windows operating systems are used, developed for
DOS FAT file system, in which for each DOS partition and volume there is
boot sector, and each DOS partition contains two copies of the table
file allocation table (FAT).
FAT is a matrix that states the relationship
between the files and folders of the partition and their physical location on the hard drive
In front of each hard disk partition there are two sequentially located
copies of FAT. Like boot sectors, FAT is located outside
area of the disk visible to the file system.
When written to disk, files do not necessarily take up space,
equivalent to their size. Typically files are split into clusters
of a certain size, which can be scattered throughout the section.
As a result, the FAT table is not a list of files and their
locations, and a list of section clusters and their contents, and at the end
FAT table entries are 12-, 16-, and 32-bit
hexadecimal numbers, the size of which is determined by the FDISK program, and
the value is directly generated by the FORMAT program.
All floppy disks and hard disks up to 16 MB in size
FAT uses 12-bit elements. Hard and removable drives that have
size from 16 MB or more, 16-bit elements are usually used.
The FAT file system was used in all versions of MS-DOS and in the first
two releases of OS/2 (versions 1.0 and 1.1). Each logical volume had
own FAT, which performed two functions: contained information
distributions for each file in the volume in the form of a list of module associations
distributions (clusters) and indicated which distribution modules are free.
When the FAT table was invented, it was an excellent solution for
disk space management, mainly because floppy disks,
on which it was used were rarely more than a few Mb in size.
FAT was small enough to remain in memory permanently,
allowed for very fast random access to any part
any file.
When FAT was applied to hard drives, it became too big
for memory resident and degraded system performance.
In addition, since information regarding free disk space
space was distributed “across” a large number of FAT sectors,
it was impractical when allocating file space, and
File fragmentation has proven to be a barrier to high efficiency.
In addition, the use of relatively large clusters on hard
disks led to a large number of unused areas, since in
On average, for each file, half the cluster was wasted.
For several years, Microsoft and IBM have been trying to extend
life of the FAT file system due to the removal of volume size restrictions,
improving distribution strategies, pathname caching, and relocation
tables and buffers into extended memory. But they can only be regarded
as temporary measures because the file system simply didn't fit
large random access devices.
§ 2 File system of the MS-DOS operating system.
One of the concepts of the MS DOS file system is a logical disk.
Logical drives:
DOS, each logical disk is a separate magnetic disk. Each logical
the disk has its own unique name. As a logical drive name
letters of the English alphabet from A to Z (inclusive) are used.
The number of logical drives is therefore no more than 26.
Letters A and B are reserved strictly for the floppy disks available in the IBM PC (
Starting with the letter C, logical drives (partitions) are named HDD (
Winchester).
The pictures show an image of a logical disk.
If a given IBM PC has only one FDD, the letter B is skipped
Only logical drives A and C can be system drives. File
logical disk structure:
To access information on disk (located in a file), you need
know the physical address of the first sector, (Nsurfaces+Ntracks+Nsectors),
the total number of clusters occupied by this file, the address of the next
cluster, if the file size is larger than the size of one cluster, etc. All
it's very vague, difficult and unnecessary.
MS DOS saves the user from such work and does it itself. For
providing access to files - the MS DOS file system organizes and
maintains a specific file structure on a logical disk.
File structure elements:
Start sector (boot sector, Boot sector),
Data area (remaining free disk space)
These elements are created by special programs (in the MS DOS environment) in the process
disk initialization.
Start sector (boot sector, Boot sector):
Here is the information required by MS DOS to work with the disk:
OS ID (if the disk is system),
Disk sector size,
Number of sectors in the cluster,
Number of spare sectors at the beginning of the disk,
Number of FAT copies on the disk (standard - two),
Number of items in the directory,
Number of sectors on the disk,
Disc format type,
Number of sectors in FAT,
Number of sectors per track,
Number of surfaces
OS boot block,
Behind the starting sector is FAT.
FAT(File Allocation Table):
The disk data area (see above) is presented in MS DOS as a sequence
numbered clusters.
FAT is an array of elements that address clusters of the disk's data area.
Each data area cluster corresponds to one FAT element.
FAT elements serve as a chain of links to file clusters in the area
FAT is an extremely important element of the File structure. Violations in FAT can
lead to complete or partial loss of information on the entire logical disk.
That is why two copies of FAT are stored on the disk. There are special programs
which monitor the status of FAT and correct violations.
Root directory:
This is a specific area of the disk created during the initialization process.
(formatting) the disk, which contains information about files and directories,
stored on disk.
The Root Directory always exists on a formatted disk. On
There is always only one root directory on one disk. Root size
directory for a given disk is a fixed value, so the maximum
the number of files and other (child) directories “attached” to it
(Subdirectories) - strictly defined.
So, summing up all of the above, we can conclude MS-DOS - 16-
bit operating system running in real processor mode.
§ 4 File system of the Windows 95 operating system.
4.1. Background to the creation of FAT 32.
In the field of personal computers, a crisis arose in 1987.
Features of the FAT file system, developed by Microsoft over ten years
years before for the Standalone Disk Basic interpreter and later
adapted for the DOS operating system were exhausted. FAT
was intended for hard drives with a capacity of no more than 32 MB, and the new HDDs
larger capacities turned out to be completely useless for PC users.
Some independent vendors have offered their own solutions
this problem, but only with the advent of DOS 4.0 this crisis was overcome -
for a while.
Significant changes to the file system structure in DOS 4.0
allowed the operating system to work with disks with a capacity of up to 128 MB; With
Subsequent minor additions raised this limit to
2 GB. At that time it seemed that this amount of memory exceeded any
imaginable needs. However, if the history of personal computers is anything to go by
and taught, then precisely that the capacity “exceeds any conceivable
needs", very quickly becomes "almost insufficient for serious
works." Indeed, hard drives are currently commercially available
capacity is usually 2.5 GB and higher, and sometimes very high and
The 2 GB ceiling that freed us from limitations has turned into yet another
an obstacle to be overcome.
4.2. Description of FAT 32.
Microsoft has developed a new extension for Windows 95 systems.
FAT - FAT32 systems, without any loud statements provided for in
OEM Service Pack 2.
The FAT32 system is installed only in new PCs, and do not count on
get it when upgrading to a new version of Windows 95, although it says
Microsoft, this extension will become part of the main package for
Windows upgrades
4.2.1. Disk areas
This file system provides a number of special areas on
disk allocated to organize disk space during its
formatting - boot head record, disk partition table, record
downloads, file allocation table (from which the FAT system got its
name) and root directory.
At the physical level, disk space is divided into 512 bytes
areas called sectors. The FAT system allocates space for files
blocks, which consist of an integer number of sectors and are called clusters.
The number of sectors in a cluster must be a multiple of a power of two. At Microsoft
these clusters are called memory allocation units, and in
SCANDISK report indicates their size, for example "16,384 bytes each
memory allocation unit."
4.2.2. FAT chain
FAT is a database that links disk clusters
file spaces. This database provides for each cluster
only one element. The first two elements contain information about the
FAT system. The third and subsequent elements are matched
clusters of disk space, starting with the first cluster allocated
for files. FAT elements can contain several special values,
indicating that
The cluster is free, i.e. not used by any file;
The cluster contains one or more sectors with physical defects and
should not be used;
This cluster is the last cluster of the file.
For any element used by the file, but not the last cluster
FAT contains the number of the next cluster occupied by the file.
Each directory - regardless of root or subdirectory - also
is a database. In the DOS directory for each file
there is one master record (In Windows 95, for long names
files, additional entries have been entered). Unlike FAT, where each element
consists of a single field, entries for a file in a directory consist of
several fields. Some fields - name, extension, size, date and time -
can be displayed on the screen using the DIR command. But the FAT system provides
the field that is not displayed by the DIR command is the field numbered first
cluster allocated for the file.
When a program sends a request to the operating system, with
request to provide her with the contents of some file, the OS looks through
a directory entry for it to find the first cluster of that file. Then she
accesses the FAT entry for a given cluster to find the next
cluster in the chain. Repeating this process until the last one is detected
file cluster, the OS determines exactly which clusters belong to this
file and in what sequence. In this way the system can provide
program any part of the file it requests. This way of organizing
The file is called a FAT chain.
In the FAT system, files are always allocated an integer number of clusters. At 1.2-
GB hard disk with 32 KB clusters in the directory can be specified,
that the size of a text file containing the words "hello, world" is
only 12 bytes, but in fact this file takes up 32 KB of disk space
space. The unused part of the cluster is called wasted space
(slack). In small files, almost the entire cluster may be lost
place, and on average the losses are half the size of the cluster.
On an 850 MB hard drive with 16 KB clusters at a medium size
files about 50 KB about 16% of the disk space allocated for files
space will be lost to unused but allocated files
One way to free up disk space is by using
disk compression programs such as DriveSpace, which highlight "lost"
space" for use by other files.
4.2.3. Other changes in FAT32
To ensure the ability to work with an increased number of clusters, in
directory entries for each file must allocate 4 bytes for the initial
file cluster (instead of 2 bytes in the FAT16 system). Traditionally, each entry in
directory consists of 32 bytes (Fig. 1). In the middle of this record there are 10 bytes
used (bytes 12 to 21), which Microsoft has reserved for
their own needs in the future. Two of them are now allocated as
additional bytes required to indicate the starting cluster in the system
The operating system has always provided for the presence of two
FAT instances, but only one of them was used. With the transition to FAT32
the operating system can work with any of these copies. One more thing
The change is that the root directory, which previously had a fixed
size and strictly defined disk space, you can now freely
grow as needed, like a subdirectory. Doesn't exist now
restrictions on the number of entries in the root directory. This is especially important
because there are multiple entries for each long file name
catalogue.
Combination of Roaming Root and Feature
using both copies of FAT are good prerequisites for unhindered
dynamic resizing of disk partitions, for example reducing a partition
in order to free up space for another operating system. This new one
approach is less dangerous than those used in third-party programs
to change disk partitions when working with FAT16.
From all of the above we can conclude:
MS-DOS was a purely 16-bit operating system and ran in
real processor mode. In Windows 3.1 versions, some of the code was 16-
bit, and some are 32-bit. Windows 3.0 supported real mode
processor operation, when developing version 3.1 it was decided to abandon it
support.
Windows 95 is a 32-bit operating system that
bit code for compatibility with MS-DOS mode. Windows 95 32-bit
bit code.
§ 5 File system of the Windows NT operating system.
5.1. Brief description of the Windows NT operating system.
At the moment, the global computer industry is developing very
rapidly. System performance increases, and therefore
The ability to process large volumes of data is increasing.
Operating systems of the MS-DOS class can no longer cope with this
data flow and cannot fully use the resources of modern
computers. Therefore, recently there has been a transition to more powerful and
the most advanced operating systems of the UNIX class, examples of which are
is Windows NT released by Microsoft Corporation
When the user sees the Microsoft operating system for the first time
Windows NT, a clear external resemblance to
favorite interface of the Windows 3.+ system. However, this is a visible similarity
is only a minor part of Windows NT.
Windows NT is a 32-bit operating system with
priority multitasking. As fundamental components
The operating system includes security features and
developed network service.
Windows NT also provides compatibility with many other
operating and file systems, as well as networks.
As shown in the following figure, Windows NT is
a modular (more advanced than a monolithic) operating system that
consists of separate interconnected relatively simple modules.
The main modules of Windows NT are (listed in order
following from the lower level of the architecture to the upper): level
hardware abstractions HAL (Hardware Abstraction Layer), kernel (Kernel),
execution system (Executive), protected subsystems (protected
subsystems) and environment subsystems.
Modular structure of Windows NT
5.2. Windows NT file system.
When Windows NT first came out, it included
support for three file systems. This is the File Allocation Table (FAT),
providing compatibility with MS-DOS, a file system with increased
performance (HPFS), providing compatibility with LAN Manager, and
a new file system called the Emerging Technologies File System
NTFS had a number of advantages compared to those used on
that point for most file servers is file systems.
To ensure data integrity, NTFS has a transaction log.
This approach does not exclude the possibility of information loss, however,
significantly increases the likelihood that file system access
will be possible even if the integrity of the system is compromised
server. This becomes possible by using a transaction log to
tracking incomplete attempts to write to disk during subsequent boot
Windows NT. The transaction log is also used to check the disk for
presence of errors instead of checking each file, in case of using
file allocation tables.
One of the main advantages of NTFS is security. NTFS
provides the ability to make access control entries (Access Control
Entries, ACE) to the Access Control List (ACL). ACE
contains a group or user identification name and an access token,
which can be used to restrict access to certain
directory or file. This access may include the ability to read,
recording, deleting, executing and even owning files.
On the other hand, an ACL is a container containing one
or more ACE records. This allows you to restrict access to certain
users or user groups to specific directories or files in
In addition, NTFS supports working with long names that have
up to 255 characters long and containing uppercase and lowercase letters in any
sequences. One of the main characteristics of NTFS is
automatic creation of equivalent names compatible with MS-DOS.
NTFS also has a compression feature, which first appeared in the NT version
3.51. It provides the ability to compress any file, directory or disk
NTFS. Unlike MS-DOS compression programs that create a virtual disk,
having the appearance of a hidden file and compressing all data on this disk,
Windows NT uses an additional layer of the file subsystem for compression
and decompress the required files without creating a virtual disk. This
turns out to be useful when compressing either a specific part of the disk (for example,
user directory), or files of a specific type
(for example, graphic files). The only disadvantage of NTFS compression is
is low, in comparison with MS-DOS compression schemes, level
compression. But NTFS is more reliable and
productivity.
So, from all of the above we can conclude:
To be compatible with various operating systems, Windows
NT contains the FAT 32 file system. In addition, Windows NT contains its own
its own NTFS file system, which is not compatible with FAT 16. This
the file system has a number of advantages over FAT, as well as
features higher reliability and performance.
Conclusion.
MS-DOS - 16-bit operating system, runs in real
processor mode. In versions of Windows 3.1, some of the code is 16-bit, and some
32-bit. Windows 3.0 supported real processor mode,
During the development of version 3.1, it was decided to abandon its support.
Windows 95 is a 32-bit operating system that
works only in protected processor mode. Core including management
memory and process dispatching, contains only 32-bit code. This
reduces costs and speeds up work. Only some modules have 16-
bit code for compatibility with MS-DOS mode. On Windows 95 32-bit
The code is used wherever possible, which allows us to ensure
increased reliability and fault tolerance of the system. In addition to this, for
compatibility with legacy applications and drivers is used and 16-
bit code.
Windows NT is not a further development of earlier
existing products. Its architecture was created from scratch, taking into account
requirements for a modern operating system. Striving
ensure compatibility of the new operating system,
Windows NT developers retained the familiar Windows interface and implemented
support for existing file systems (such as FAT) and various
applications (written for MS - Dos, Windows 3.x). The developers also
included in Windows NT tools for working with various network
means.
Reliability and robustness
provide architectural features that protect application
programs from being damaged by each other and by the operating system. Windows NT
uses fault-tolerant structured exception handling on
all architectural levels, which includes recoverable file
NTFS system and provides protection using the built-in system
security and advanced memory management techniques.
The initial sector of the hard disk contains the main root record, which is loaded into memory and executed.
The last part of this sector contains the partition table - a 4-element table with 16-byte elements. This table is manipulated by the FDISK program (or an equivalent utility on another operating system).
During boot, the ROM-BIOS loads the master root entry and transfers control to its code. This code reads the partition table to determine the partition that is marked as active. The correct root sector is then read into memory and executed.
Table 1. Structure of the master root entry and partition table
Table 2. Section Descriptor Structure
The partition code is used to determine the presence and location of the primary and extended partitions on the disk. Once the desired partition has been located, its size and coordinates can be extracted from the corresponding descriptor fields. If 0 is written in the partition code field, then the descriptor is considered empty, that is, it does not define any partition on the disk.
Table 3. Microsoft operating system partition codes
Code | Section type | Size | FAT type | OS |
---|---|---|---|---|
01h | Basic | 0-15 MB | FAT12 | MS-DOS 2.0 |
04h | Basic | 16-32 MB | FAT16 | MS-DOS 3.0 |
05h | Advanced | 0-2 GB | - | MS-DOS 3.3 |
06h | Basic | 32 MB-2 GB | FAT16 | MS-DOS 4.0 |
0Bh | Basic | 512 MB-2 GB | FAT32 | OSR2 |
0Ch | Advanced | 512 MB-2 TB | FAT32 | OSR2 |
0Eh | Basic | 32 MB-2 GB | FAT16 | Windows 95 |
0Fh | Advanced | 0-2 GB | - | Windows 95 |
The following codes are reserved for operating systems of other companies:
- 02h - CP/M section;
- 03h - Xenix section;
- 07h - OS/2 partition (HPFS file system).
Notes:
- Cylinder and sector numbers occupy 10 and 6 bits, respectively:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 c c c c c c c c c c s s s s s s
They are arranged so that when you load CX with a 16-bit value, it is ready to call interrupt INT 13h to read the desired portion of the disk. Thus, after reading the Master Load Record into the sect_buf memory area, the code is CMP byte ptr sect_buf, 80hwill check if the first partition is active, and the code
MOV CX, sect_buf
will load CX to call INT 13h to read the root sector of partition #1.
- The "relative sector" value at offset 08h in each partition is equivalent to the head, sector and cylinder of the partition's starting address. Relative sector 0 coincides with cylinder 0, head 0, sector 1. The relative sector number increases first for each sector on the head, then for each head, and finally for each cylinder.
Applicable formula:
Rel_sec = (#Cyl * sec_per_cyl * heads) + (#Goal * sec_per_cyl) + (#Sec -1)
Partitions start at an even cylinder number, with the exception of the first partition, which can start at cylinder 0, head 0, sector 2 (since sector 1 is occupied by the Master Boot Record).
When the root partition entry gains control, DS:SI points to the corresponding partition table entry.
Root sector structure
Table 4. Format of the root sector of a floppy disk or hard disk partition
00h | 3 | JMP | xx xx | NEAR jump to download code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
03h | 8 | "I" | "B" | "M" | "4" | "." | "0" | OEM company name and system version | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0Bh | 2 | SectSiz | number of bytes in sector (always 512) | start of BPB 0Dh | 1
| ClustSiz | number of sectors in the cluster |
0Eh | 2
| ResSecs | number of spare sectors (sectors before FAT #1) |
10h | 1
| FatCnt | number of FAT tables |
11h | 2
| RootSiz | number of 32-byte elements of the root directory (for FAT32 - 0) |
13h | 2
| TotSecs | total number of sectors on the media (DOS partition) |
15h | 1
| Media | media type (same as 1st byte of FAT) |
16h | 2
| FatSize | number of sectors in one FAT | end BPB |
18h | 2
| TrkSecs |
|
| number of sectors per track |
1Ah | 2
| HeadCnt |
| number of heads |
1Ch | 4
| HidnSec | number of hidden sectors (used in partition schemes) |
20h | 4
| TotSecs | total sectors if size >32 MB |
24h | 1
| 128
|
|
| physical disk number |
25h | 1
|
|
| reserve |
26h | 1
| 29h |
| sign of extended structure |
27h | 4
|
| Volume ID (serial number) |
2Bh | Bh |
| label (NO NAME) |
36h | 8
|
| File system ID (FAT12) |
3Eh |
| start of loading code and data |
|
Notes:
- Types of storage media:
- F0h - floppy disk, 2 sides, 18 sectors per track;
- F8h - hard drive;
- F9h - floppy disk, 2 sides, 15 sectors per track;
- FCh - floppy disk, 1 side, 9 sectors per track;
- FDh - floppy disk, 2 sides, 9 sectors per track;
- FEh - floppy disk, 1 side, 8 sectors per track;
- FFh - floppy disk, 2 sides, 8 sectors per track.
- Use absolute read INT 25h (DX=0) to read this sector. OR:
- floppy disks: root sector = BIOS INT 13h head 0, track 0, sector 1;
- hard: read Partition_Table for head/track/sector BIOS.
- BPB (BIOS Parameter Block) is a subset of data contained in the root_sector. The "Build BPB" driver request requires the driver to fill out the block noted above. BPB length = 13 bytes
Floppy disk parameters table
This 10-byte structure is also known as a "Disk Base Table". It is located at the interrupt vector address INT 1Eh (4-byte address at 0:0078). This table specifies some important variables for floppy devices. It is initialized by ROM-BIOS and modified by DOS to improve the performance of floppy disks.
Table 5. Floppy Disk Parameter Table Format
Bias | Length | Content |
---|---|---|
00h | 1 | First byte of the specification: bits 0-3 - head loading time; bits 4-7 - head step duration |
01h | 1 | Second byte of the specification: bit 0 - DMA mode flag; bits 1-7 - head loading time |
02h | 1 | Delay before turning off the motor (in “ticks” of the system clock) |
03h | 1 | Sector size (bytes): 0 - 128, 1 - 256, 2 - 512, 3 - 1024 |
04h | 1 | Number of sectors per track |
05h | 1 | Intersector gap length for read/write operations |
06h | 1 | Data area length |
07h | 1 | Intersector gap length for format operation |
08h | 1 | Placeholder character for formatting (usually 0F6h, i.e. "Ў") |
09h | 1 | Head installation time (in milliseconds) |
0Ah | 1 | Motor start time (in 1/8 s) |
Hard disk parameters table
This 16-byte structure is located at interrupt vector address INT 41h (4-byte address at 0:0104). The parameters for the second hard drive (if there is one) are located at vector address INT 46h. These tables define some important variables for hard drive operations.
Table 6. Hard disk table format
Bias | Length | Content |
---|---|---|
00h | 2 | Number of cylinders |
02h | 1 | Number of heads |
03h | 2 | Not used (always 0) |
05h | 2 | Precompensation starting cylinder number |
07h | 1 | Maximum ECC block length |
08h | 1 | Control byte: bits 0-2 - not used (always 0); bit 3 - set if the number of heads is more than 8; bit 4 - not used (always 0); bit 5 - set if the manufacturer has placed a defect map on the cylinder with the number “maximum working cylinder + 1”; bit 6 - ECC recheck prohibition; bit 7 - ECC control disabled |
09h | 1 | Not used (always 0) |
0Ah | 1 | Not used (always 0) |
0Bh | 1 | Not used (always 0) |
0Ch | 2 | Parking zone cylinder number |
0Eh | 1 | Number of sectors per track |
0Fh | 1 | Reserve |
File Allocation Table (FAT)
File size may change over time. If you allow a file to be stored only in adjacent sectors, then when the file size increases, the OS must completely rewrite it to another suitable size (free) area of the disk. To simplify and speed up the operation of adding new data to a file, modern operating systems use file distribution tables (File Allocation Table, abbreviated FAT), which allow you to store a file in several non-contiguous sections.
When using FAT, the data area of a logical disk is divided into sections of the same size - clusters. A cluster can consist of one or several sectors located sequentially on a disk. The number of sectors in a cluster must be a multiple of 2 N and can take values from 1 to 64 (the cluster size depends on the type of FAT used and the size of the logical disk).
Each cluster is assigned its own FAT table element. The first two FAT elements are reserved - if there are K data clusters on the disk, then the number of FAT elements will be K+2. The FAT type is determined by the value of K:
- if K<4085 - используется FAT12;
- if 4084>K<65525 - используется FAT16;
- if 65524> K - FAT32 is used.
The name of FAT types comes from the size of the element. So a FAT12 element has a size of 12 bits, FAT16 - 16 bits, FAT32 - 32 bits. Please note that in FAT32, the four most significant binary bits are reserved and are ignored during OS operation (that is, only the seven least significant hexadecimal bits of the element are significant).
FAT is a linked list that the OS uses to keep track of the physical location of data on a disk and to find free memory for new files.
The file directory (table of contents) for each file contains the number of the starting element in the FAT table, corresponding to the first cluster in the file distribution chain. The corresponding FAT element either indicates the end of the chain, or refers to the next element, etc. Example:
This diagram illustrates the basic concepts of FAT. From it it is clear that:
- MYFILE.TXT occupies 10 clusters. The first cluster is cluster 08, the last cluster is 1Bh. Cluster chain - 08h, 09h, 0Ah, 0Bh, 15h, 16h, 17h, 19h, 1Ah, 1Bh. Each element points to the next element of the chain, and the last element contains a special code (see Table 7).
- Cluster 18h is marked as defective and is not included in the distribution chain.
- Clusters 06h, 07h, 0Ch-14h and 1Ch-1Fh are empty and available for distribution.
- Another chain begins with cluster 02h and ends with cluster 05h. To find out the file name, you need to find the table of contents element with the starting cluster number 02h.
Table 7. FAT element values
FAT usually starts at logical sector 1 in the DOS partition (i.e. it can be read by INT 25h with DX=1). In general, you first need to read the root_sector (DX=0) and take the offset 0Eh . It indicates how many root and reserve sectors are in front of the FAT. Then use this number (usually 1) as the contents of DX to read the FAT via INT 25h .
There may be multiple copies of FAT. Typically two identical copies are maintained. In these cases, all copies are located directly next to each other.
Comment:
- According to a common misconception, it is believed that 16-bit FAT does not allow DOS to work with disks larger than 32 megabytes. In fact, the limitation is that INT 25h/26h is unable to work with SECTOR numbers greater than 65535. Since the sector size is usually 512 bytes, or half a kilobyte, this dictates a 32-megabyte limit. On the other hand, nothing prevents you from having larger sectors, so theoretically DOS can work with any disk.
- Multiply the cluster number by 3.
- If the element number is even, AND the word read and the mask 0FFFh. If the element number is odd, shift the value to the right by 4 bits. As a result, you will get the desired value of the FAT element.
Now let's look at the procedure for writing an element to FAT12.
- Multiply the cluster number by 3.
- Divide the result by 2 (element length is 1.5 (3/2) bytes).
- Read a 16-bit word from FAT using the result of the previous operation as the address.
- If the element number is even, perform an AND operation on the word read and the mask 0F000h, and then an OR operation on the resulting result and the value of the element written. If the element number is odd, AND the word read and the mask 0F000h, then shift the value left 4 bits and OR the result of the previous operation.
- Write the resulting 16-bit word back to FAT.
Comment:
- A 12-bit element can cross two sector boundaries, so be careful if you are reading one FAT sector at a time.
16-bit elements are simpler - each element contains the 16-bit offset (from the beginning of the FAT) of the next element in the chain.
32-bit elements - Each element contains the 32-bit offset of the next element in the chain.
In assembly language programs, the shift-and-add algorithm is often used instead of the MUL instruction to perform multiplication by 3: the original number is copied, the copy of the number is shifted left one place (multiplying by 2), and then both numbers are added (x + 2x = 3x). Instead of the DIV command, shift right one bit.
The FAT element contains the cluster number, but when working with disks at a low level, the addressable unit of data is the sector, not the cluster.
A floppy disk (or hard disk partition) is structured as follows:
- root and reserve sectors;
- FAT#1;
- FAT #2;
- root directory (does not exist in FAT32);
- data area.
Each section in this structure has a variable length, and to correctly convert the cluster number to the sector number, you need to know the length of each such section.
To get the cluster starting sector number from the ClustNum cluster number (read from the corresponding field in the directory entry or FAT chain), you can use the undocumented OS 32h function, or read the root sector and apply the following formulas:
root_sectors = (RootSiz * 32) / 512 start_data = ResSecs + (FatSize * FatCnt) + root_sectors start_sector = start_data + ((ClustNum - 2) * ClustSiz) ,
where the values of the variables: RootSiz, ResSecs, FatSize, FatCnt, ClustSiz are retrieved from the root sector or from BPB.
Set DX=start_sector before the INT 25h read or INT 26h write operation.
File directories
The file directory is an array of 32-byte elements - file descriptors. From the operating system's point of view, all directories (except the root directory in FAT12 and FAT16 systems) look like files and can contain an arbitrary number of entries.
The Root Directory is the main directory of the disk from which the subdirectory tree begins. For the root directory in FAT12 and FAT16, a special fixed-size space (16 KB) is allocated in the system area of the logical disk, designed to store 512 elements. In a FAT32 system, the root directory is a file of any size.
Table 8. Catalog Item Structure
Bias | Length | Content |
---|---|---|
00h | 11 | Short file name |
0Bh | 1 | File attributes |
0Сh | 1 | *Reserved for Windows NT (must contain 0) |
0Dh | 1 | *Field specifying the file creation time (in tens of milliseconds). The field value can range from 0 to 199 |
0Eh | 2 | *File creation time |
10h | 2 | *File creation date |
12h | 2 | *Date of the last access to the file to write or read data |
14h | 2 | *The most significant word of the number of the first cluster of the file |
16h | 2 | Time of last write operation to file |
18h | 2 | Date of the last write operation to the file |
1Ah | 2 | Low word of the file's first cluster number |
1Ch | 4 | File size in bytes (32-bit number) |
The "*" sign means that the field is processed only in the FAT32 file system. In FAT12 and FAT16 systems, the field is considered reserved and contains the value 0.
The short file name consists of two fields: an 8-byte field containing the actual file name, and a 3-byte field containing the extension. If the file name entered by the user is shorter than eight characters, then it is padded with spaces (space code - 20h), if the entered extension is shorter than three characters, then it is also padded with spaces.
Some DOS functions require a file attribute byte as a parameter. The bits of the attribute byte are set to 1 if the file has the corresponding property:
- bit 0 - read only;
- bit 1 - hidden;
- bit 2 - system;
- bit 3 - volume identifier;
- bit 4 - directory;
- bit 5 - archived;
- bits 6 and 7 are reserved (set to 0).
The file creation time field and the time field of the last write operation to the file have the following format:
15 | 9 | 8 | 5 | 4 | 0 |
When creating files, dates are counted from the beginning of the MS-DOS era, i.e. from 01/01/1980. Bits 9-15 contain the year number minus 1980 (valid values from 0 to 127).
Long file names
Starting with Windows 95, a file can be assigned (in addition to a short name) a so-called long name. To store a long name, empty directory elements adjacent to the main element - the file descriptor - are used. The presence of ones in bits 0-3 of the attribute byte is a sign that a free directory element is used to store a portion of a long file name (this combination is not possible for file and directory descriptors). The short and long file names are unique, i.e. must not appear twice in the same directory.
A long name is written not in ASCII characters, but in the Unicode format, where each national alphabet has a corresponding set of codes. The price to pay for the universality of Unicode is a reduction in information storage density - each character occupies two bytes (16-bit word). In empty directory elements, the long name is written cut into pieces (see Table 9).
Table 9. Structure of a directory element storing a fragment of a long file name
The long name is written to the directory first, with the fragments placed in reverse order, starting with the last one:
All directories, with the exception of the root directory, contain special links in the first two elements instead of file descriptors. Element No. 0 contains a pointer to the directory itself, and the name field contains a single dot ("."). Element #1 contains a pointer to the parent directory, and the name field contains two dots (".."). If the FAT table reference for item #1 has a null value, then the current directory is in the root directory.
The disk information block is formed by the UNDOCUMENTED DOS 32h function.
All the information contained here can be obtained by reading the root sector and calling a number of other OS functions with some calculations, but the information block is useful in that it contains all the data together. This is the only call that returns the address of the device driver header.
Table 10. Disk information block diagram
Bias | Length | Content |
---|---|---|
00h | 1 | Disc number (0=A, 1=B, etc.) |
01h | 1 | Subdevice number from the device header (one driver can manage multiple drives) |
02h | 2 | Sector size in bytes |
04h | 1 | Number of sectors per cluster -1 (max. sector per cluster) |
05h | 1 | Shift a cluster to a sector (cluster = 2# sectors) (sectors per cluster in powers of two: 2 for 4, 3 for 8) |
06h | 2 | Number of spare sectors (root, start of root section) (N of first FAT sector) |
08h | 1 | Number of FAT tables |
09h | 2 | Max. number of elements in root table of contents |
0Bh | 2 | Sector number for cluster No. 2 (1st data cluster) |
0Dh | 2 | Total clusters +2 (highest cluster number) |
0Fh | 1 | Number of sectors occupied by one FAT |
10h | 2 | Sector number of the beginning of the root table of contents |
12h | 4 | Device_header address |
16h | 1 | MediaDescriptor Byte |
17h | 1 | Access flag: 0 if the device was accessed |
18h | 4 | Address of the next disk information block (0FFFFh if the block is the last one) |
Opening mode bit flags:
- 0-2: Process access rights on the network
000 - reading; 001 - record; 010 - read and write. - 4-6: Split mode:
000 - compatibility mode
001 = exclusive file capture
010 = reject entry
011 = reject reading
100 = don't reject anything - 7: Inheritance:
1 - the file is private for this process 0 - inherited by child processes
If the file attribute byte indicates read-only, it overrides these flags.
The network permissions and sharing mode bits only have an effect when the SHARE program is installed.
About files and file structures
What is a file
Information on external media is stored in the form of files. Working with files is a very important type of computer work. Everything is stored in files: both software and information necessary for the user. With files, as with business papers, you constantly have to do something: copy them from one medium to another, destroy unnecessary ones, create new ones, search for them, rename them, put them in one order or another, etc.
File- this is information stored on external media and united by a common name.
To clarify the meaning of this concept, it is convenient to use the following analogy: the storage medium itself (disk) is like a book. We talked about the fact that a book is the external memory of a person, and a magnetic disk is the external memory of a computer. The book consists of chapters (stories, sections), each of which has a title. The files also have their own names. These are called file names. At the beginning or end of a book there is usually a table of contents - a list of chapter titles. There is also such a directory list on the disk containing the names of the stored files.
You can display the directory to see if the file you need is on the drive.
Each file stores a separate information object: a document, an article, a numeric array, a program, etc. The information contained in the file becomes active, i.e., can be processed by a computer, only after it is loaded into RAM.
Any user who works on a computer has to deal with files. Even in order to play a computer game, you need to find out in which file its program is stored, be able to find this file and initialize the program.
Working with files on a computer is done using the file system. File system- this is a functional part of the OS that performs operations on files.
To find the required file, the user must know: a) what the file name is; b) where the file is stored.
File name
In almost all operating systems, the file name is composed of two parts separated by a dot. For example:
To the left of the dot is the actual file name (tu-prog). The part of the name following the dot is called the file extension (pas). Usually Latin letters and numbers are used in file names. On most operating systems, the maximum extension length is 3 characters. In addition, the file name may not have an extension. In the Windows operating system, Russian letters are allowed in file names; The maximum name length is 255 characters.
The extension indicates what kind of information is stored in this file. For example, the txt extension usually denotes a text file (contains text); extension pxx - graphic file (contains a picture), zip or gag - archive file (contains archive - compressed information), pas - program in Pascal.
Logical drives
One computer can have several disk drives - devices for working with disks. Each drive is given a one-letter name (followed by a colon), for example A:, B:, C:. Often on personal computers, a large-capacity disk built into the system unit (called a hard drive) is divided into partitions. Each of these partitions is called a logical disk, and it is given the name C:, D:, E:, etc. The names A: and B: usually refer to small-capacity removable disks - floppy disks (floppy disks). They can also be considered as names of disks, only logical ones, each of which completely occupies a real (physical) disk. Therefore, A:, B:, C:, D: are all names of logical drives.
The name of the logical drive containing the file is the first "coordinate" that determines the location of the file.
Disk file structure
The entire collection of files on the disk and the relationships between them is called file structure. Different operating systems may support different file structure organizations. There are two types of file structures: simple, or single-level, and hierarchical - multi-level.
Single-level file structure is a simple sequence of files. To find a file on disk, you only need to specify the file name. For example, if the tetris.exe file is located on drive A:, then its “full address” looks like this:
Operating systems with a single-level file structure are used on the simplest educational computers equipped only with floppy disks.
Multi-level file structure- a tree-like (hierarchical) way of organizing files on a disk. To facilitate understanding of this issue, we will use an analogy with the traditional “paper” method of storing information. In this analogy, a file is represented as some titled document (text, drawing) on paper sheets. The next largest element in the file structure is called catalog. Continuing the “paper” analogy, we will think of a directory as a folder into which you can attach many documents, i.e. files. The directory also gets its own name (think of it on the cover of a folder).
The directory itself can be part of another directory external to it. This is similar to nesting a folder inside another larger folder. Thus, each directory can contain many files and subdirectories (called subdirectories). The top-level directory that is not nested within any other directory is called the root directory.
In the Windows operating system, the term "folder" is used to refer to the concept of "directory".
A graphical representation of a hierarchical file structure is called a tree.
In Fig. 2.9 directory names are written in capital letters, and file names are written in lowercase letters. Here in the root directory there are two folders: IVANOV and PETROV and one file fin.com. The IVANOV folder contains two subfolders PROGS and DATA. The DATA folder is empty; there are three files in the PROGS folder, etc. In the tree, the root directory is usually represented by the symbol \.
File path
Now imagine that you need to find a specific document. To do this, you need to know the box in which it is located, as well as the “path” to the document inside the box: the entire sequence of folders that need to be opened to get to the papers you are looking for.
The second coordinate that determines the location of the file is path to the file on disk. The path to a file is a sequence of directory names, starting from the root directory and ending with the one in which the file is directly stored.
Here is a familiar fairy-tale analogy to the concept of “path to a file”: “There is a chest hanging on an oak tree, in the chest there is a hare, in the hare there is a duck, in the duck there is an egg, in the egg there is a needle, at the end of which is Koshcheev’s death.”
The logical drive name, file path and file name written down in sequence make up full file name.
If shown in Fig. 2.9 file structure is stored on the C: drive, then the full names of some of the files included in it in the symbolism of the MS-DOS and Windows operating systems look like this:
C:\IVANOV\PROGS\progl.pas
C:\PETROV\DATA\task.dat
File Allocation Table
Information about the file structure of the Disk is contained on the same disk in the form of a file allocation table. Using the OS file system, the user can sequentially view the contents of directories (folders) on the screen, moving down or up the file structure tree.
In Fig. Figure 2.10 shows an example of displaying a directory tree on logical drive E: on a computer screen (left window).
The right window shows the contents of the ARCON folder. ")then there are many files of different types. Hence, for example, it is clear that the full name of the first file in the list is as follows:
E:\GAME\GAMES\ARCON\dos4gw.exe
From the table you can get additional information about the files. For example, the file dos4gw.exe is 254,556 bytes in size and was created on May 31, 1994 at 2:00 am.
Having found an entry about the desired file in such a list, using OS commands, the user can perform various actions with it: initialize the program contained in the file; delete, rename, copy file. You will learn how to perform all these operations in a practical lesson.
Questions and tasks
- 1. What is the name of the operating system used in your computer lab?
2. What file structure does the operating system use on your computers (simple, multi-level)?
3. How many physical drives do your computers have? How many logical disks are there on physical disks and what names do they have in the operating system?
4. What rules govern file names in your OS?
5. What is the path to the file on the disk, the full file name?
6. Learn (under the guidance of a teacher) to view disk directories on your computers on the screen.
7. Learn to initialize programs from program files (such as exe, com).
8. Learn to perform basic file operations in the operating system you are using (copying, moving, deleting, renaming files).
User Interface
Friendly user interface
Now get acquainted with the new concept of “user interface”.
Developers of modern software are trying to make the user's work at the computer convenient, simple, and visual. The consumer qualities of any program are largely determined by the convenience of its interaction with the user.
The form of interaction between a program and a user is called user interface. A user-friendly form of interaction is called a user-friendly interface.
Object-oriented interface
The interface of modern system and application programs is called an object-oriented interface. An example of an operating system that implements an object-oriented approach is Windows.
The operating system works with many objects, which include: documents, programs, disk drives, printers and other objects that we deal with when working in the operating system.
Documents contain some information: text, sound, pictures, etc. Programs are used to process documents. Individual programs and documents are inextricably linked: a text editor works with text documents, a graphics editor works with photographs and illustrations, and a sound processing program allows you to record, edit and listen to sound files.
Documents and programs are information objects. And objects such as disk drives and printers are hardware (physical) objects. The operating system associates the object with:
graphic designation;
properties;
behavior.
The operating system interface uses icons (also called pictograms, icons) and names to designate documents, programs, and devices. The name and icon make it possible to easily distinguish one object from another (Fig. 2.11).
Each object is associated with a specific set of properties and a set of actions that can be performed on the object.
For example, the properties of a document are its location in the file structure and its size. Actions on a document: open (view or listen), rename, print, copy, save, delete, etc.
Context menu
The operating system provides the same user interface when working with different objects. In the Windows operating system, to get acquainted with the properties of an object and the possible actions on it, the context menu is used (Fig. 2.12) (to call the context menu, select the object icon and right-click).
Menu- This is a list displayed on the screen from which the user can select the element he needs.
Rice. 2.12. Document context menu |
In the menu in Fig. 2.12 all paragraphs, except the last one, refer to actions that can be performed with the document. The desired menu item is selected using the cursor keys or a manipulator (for example, a mouse). If you select the "Properties" menu item, a list of properties of this object will be displayed on the screen.
Questions and tasks
- 1. What is the user interface?
2. How is an object characterized (from the point of view of the object-oriented approach)?
3. How can you find out the properties of an object or perform an action on it?
About files and file structures
File
File(English) file- folder) - a concept in computing: an entity that allows you to gain access to any resource of a computer system and has a number of characteristics:
- fixed name (a sequence of characters, a number or something else that uniquely characterizes the file);
- a certain logical representation and the corresponding read/write operations.
It can be anything - from a sequence of bits (although we read it in bytes, or rather in word-groups of bytes, four, eight, sixteen each) to a database with an arbitrary organization or any intermediate option; multidimensional database, strictly ordered.
The first case corresponds to read/write operations of a stream and/or array (that is, sequential or with index access), the second - DBMS commands. Intermediate options - reading and parsing all kinds of file formats.
In computer science, the following definition is used: a file is a named sequence of bytes.
Work with files is implemented using operating systems.
File names are and are processed in a similar way:
- data areas (optional on disk);
- devices (both physical, ports, for example, and virtual);
- data flows (in particular, the input or output of a process) (“pipe” should be translated as “conveyor”);
- network resources, sockets;
- operating system objects.
Files of the first type historically arose first and are the most widespread, so the data area corresponding to the name is often called a “file.”
File as data area
Information on external media is stored in the form of files. Working with files is a very important type of computer work. Everything is stored in files: both software and information necessary for the user. With files, as with business papers, you constantly have to do something: copy them from one medium to another, destroy unnecessary ones, create new ones, search for them, rename them, put them in one order or another, etc.
File- this is information stored on external media and united by a common name.
To clarify the meaning of this concept, it is convenient to use the following analogy: the storage medium itself (disk) is like a book. We talked about the fact that a book is the external memory of a person, and a magnetic disk is the external memory of a computer. The book consists of chapters (stories, sections), each of which has a title. The files also have their own names. These are called file names. At the beginning or end of a book there is usually a table of contents - a list of chapter titles. There is also such a directory list on the disk containing the names of the stored files.
You can display the directory to see if the file you need is on the drive.
Each file stores a separate information object: a document, an article, a numeric array, a program, etc. The information contained in the file becomes active, i.e., can be processed by a computer, only after it is loaded into RAM.
Any user who works on a computer has to deal with files. Even in order to play a computer game, you need to find out in which file its program is stored, be able to find this file and initialize the program.
Working with files on a computer is done using the file system. File system- this is a functional part of the OS that performs operations on files.
To find the required file, the user must know: a) what the file name is; b) where the file is stored.
File name
In almost all operating systems, the file name is composed of two parts separated by a dot. For example:
To the left of the dot is the actual file name (tu-prog). The part of the name following the dot is called the file extension (pas). Usually Latin letters and numbers are used in file names. On most operating systems, the maximum extension length is 3 characters. In addition, the file name may not have an extension. In the Windows operating system, Russian letters are allowed in file names; The maximum name length is 255 characters.
The extension indicates what kind of information is stored in this file. For example, the txt extension usually denotes a text file (contains text); extension pxx - graphic file (contains a picture), zip or gag - archive file (contains archive - compressed information), pas - program in Pascal.
Logical drives
One computer can have several disk drives - devices for working with disks. Each drive is given a one-letter name (followed by a colon), for example A:, B:, C:. Often on personal computers, a large-capacity disk built into the system unit (called a hard drive) is divided into partitions. Each of these partitions is called a logical disk, and it is given the name C:, D:, E:, etc. The names A: and B: usually refer to small-capacity removable disks - floppy disks (floppy disks). They can also be considered as names of disks, only logical ones, each of which completely occupies a real (physical) disk. Therefore, A:, B:, C:, D: are all names of logical drives. The name of the logical drive containing the file is the first "coordinate" that determines the location of the file.
There are two states of a logical disk - current and passive. Current disk – the disk on which the user is working at the current computer time. Passive disk – a disk with which there is no connection at the moment.
Disk file structure
The entire collection of files on the disk and the relationships between them is called file structure. Different operating systems may support different file structure organizations. There are two types of file structures: simple, or single-level, and hierarchical - multi-level.
Single-level file structure is a simple sequence of files. To find a file on disk, you only need to specify the file name. For example, if the tetris.exe file is located on drive A:, then its “full address” looks like this:
Operating systems with a single-level file structure are used on the simplest educational computers equipped only with floppy disks.
Multi-level file structure- a tree-like (hierarchical) way of organizing files on a disk. To facilitate understanding of this issue, we will use an analogy with the traditional “paper” method of storing information. In this analogy, a file is represented as some titled document (text, drawing) on paper sheets. The next largest element in the file structure is called catalog. Continuing the “paper” analogy, we will think of a directory as a folder into which you can attach many documents, i.e. files. The directory also gets its own name (think of it on the cover of a folder).
The directory itself can be part of another directory external to it. This is similar to nesting a folder inside another larger folder. Thus, each directory can contain many files and subdirectories (called subdirectories). The top-level directory that is not nested within any other directory is called the root directory.
In the Windows operating system, the term "folder" is used to refer to the concept of "directory".
A graphical representation of a hierarchical file structure is called a tree.
In Fig. 1 Directory names are written in capital letters, and file names are written in lowercase letters. Here in the root directory there are two folders: IVANOV and PETROV and one file fin.com. The IVANOV directory contains two subdirectories PROGS and DATA. The DATA directory is empty; there are three files in the PROGS directory, etc. In the tree, the root directory is usually represented by the symbol \.
Rice. 1. Example of a hierarchical file structure
There are two directory states (similar to logical disks) - current and passive. The operating system remembers the current directory on each logical date of the current drive, in this case the OS stores the drive name and the directory name.