Basic concepts of DOS

Time:2022-5-11

Early computer systems were usually composed of central processing unit (CPU), memory, external devices and other components. Users often monopolized all the resources of the computer. For example, when the computer prints through the printer, other devices are waiting, so the use efficiency of the computer is very low and the user waits for a long time.
With the continuous development of computer, especially the new development of various computer software, there is a system software – operating system, which is specially used to solve the above problems. The tasks of the operating system are:
(1) CPU management – allocate CPU to each task reasonably.
(2) Memory management – allocate memory reasonably.
(3) External equipment management – rational use of peripherals.
(4) Information management – automatically manage files.
After using the operating system, the user is no longer facing a bare metal (computer hardware), but facing the operating system, and the operating system becomes the interface between the user and the bare metal.
DOS is the most basic operating system software. DOS is the abbreviation of English disk operation system. The DOS operating system used by microcomputer is mainly MS-DOS developed by American Microsoft company and PC-DOS developed by IBM company. Since its birth in 1981, DOS operating system software has experienced a development process of continuous improvement and perfection. Its version has gradually developed from the original 1.0 to 5.0, 6.0, 6.22 and so on. The ms-dos6 introduced here Version 22, including many novel and powerful commands.
Functions of DOS system
To coordinate the work of all parts of a computer system and give full play to its efficiency, a manager needs to reasonably schedule its various resources – hardware and software resources. DOS operating system is such a manager.
Resources in computer systems are usually divided into four categories: processor (CPU), memory, external devices and information. DOS operating system has the management function of these four resources.
The CPU model used in the early PC series microcomputer is 8088 (8086). In recent ten years, 80286, 80386, 80486 and 80586 (also known as Pentium, which is translated as “Pentium”) have become more and more powerful. DOS 6.22 supports all the above CPUs.
The microcomputer using 8088 or 8086 CPU is limited by the conditions at that time. The ability to access the memory is limited to 1MB. The ram capacity in the memory is generally 640kb. The early DOS versions were designed for the above hardware.
Although the memory range that the advanced CPU can manage has reached 16MB (80286) and 4096mb (80386, 80486), and the version of DOS has been upgraded to 5.0, 6.0, 6.2…, in order to maintain compatibility with the lower version of DOS, DOS still limits the memory space that users can directly use to 640kb, which is also called basic memory.
Startup of DOS system
1.Composition of DOS system
DOS system is composed of a group of important programs provided by floppy disk or hard disk. The core of DOS system consists of three startup modules and a boot program. The three startup modules are input and output module (IO. Sys), file module (MSDOS. Sys) and command processing module (command. Com). The function of the boot program is to boot the two implied DOS boot modules io Sys and MSDOS Sys load memory. IO. The main function of sys is to manage input / output devices. MS-DOS. Sys is used to manage disk files and system resources. COMMAND. COM is the outermost module of the whole DOS system. Its task is to interpret and execute the commands entered by the user.
2. Startup of DOS system
To use the DOS system on the disk, the DOS system must be transferred into the memory of the computer, which is called the startup of the DOS system.
In addition to starting DOS during startup (this startup is generally called cold startup), during microcomputer operation, if the microcomputer operation is in “dead cycle” or other “crash” for some reason, DOS also needs to be restarted (this startup is generally called hot startup). Press Ctrl + Alt + Del to restart DOS. Some microcomputer panels are equipped with a button (reset), which can also restart DOS.
The startup of DOS can be divided into two types: starting from floppy disk (drive a) and starting from hard disk (also known as drive C). For the microcomputer equipped with hard disk, the priority of these two ways can be set through the modification of CMOS. If the priority set is “A:, C:”, check whether there is a DOS system in drive a before starting. If there is, start from disk A. if not, check whether there is a DOS system in hard disk C; On the contrary, if the priority is “C:, a:”, look for the DOS system from hard disk C at startup. If not, look for it from floppy disk a.
In the DOS file, there are two important files, which are in the root directory of the same boot disk:
(1) config. Sys is the system configuration file. Users can use it to specify the arrangement of memory in advance, and so on, so as to make the hardware of the system play a better role.
(2) autoexec. Bat is a batch file automatically executed at startup specified by the system. It can
A series of DOS commands (internal and external commands) are automatically executed before the user performs keyboard operation. It can set the system environment variables, search path, system prompt, screen or printer mode, and start the user program.
(3) The host of various microcomputers with 80286, 80386 and 80486 as CPU is equipped with high-energy battery. After shutdown, the clock can continue to run, and the date and time can be read out automatically when starting up.
[example] start DOS with floppy disk
(there is no autoexec.bat file on this disk).
Insert the boot disk into drive a and close the door.
After power on, the following information is displayed on the screen:
Current date is Wed ll-24-1993
Enter new date (MM DD YY):
If there is an error between the displayed date and the date of the current day, you can enter the correct value (according to the format: month day year) and press enter to correct it. Otherwise, press enter directly. After asking for the date, the following information is displayed on the screen:
Current time is 11:52:50.38a
Enter new time :
The operation of asking for time can be handled the same as the date operation.
The sign of normal end of startup is that DOS prompt a: \ > appears on the screen, which indicates that the microcomputer is currently under the control of DOS system and waiting for the user to enter the command. The letter “a” means that “current disk” is disk a. When the microcomputer is equipped with more than one disk drive, such as disk a, disk B and disk C, the command to set a disk as the current disk is:
d: (enter) (D: drive letter)
To change the current disk from disk a to Disk C, press the following underlined part:
A: \ > C: (enter)
Screen display:
C:\>
[example 2.1.2] start DOS with hard disk C.
A. keep the driver door open.
After startup, the screen generally displays the following contents:
C:\>
Documents
Under DOS operating system, the information on the disk is stored and managed in the form of files. In computer science, file refers to a set of relevant information. It can be program, data, sound, game or other information, which is generally recorded on storage medium (such as disk). Each file has its own name, called the file name. When a file needs to be used, as long as the corresponding file name is pointed out, the DOS system can accurately find the file and perform reading, writing and other operations.
1.Naming of files
In order to distinguish different files and facilitate the execution, modification and search of files, DOS operating system stipulates that the file name consists of the file main name and extension. The format is as follows:
    □□□□□□□□. □□□
It can be composed of 1-8 characters before the decimal point, which is called the main name. It can be composed of 0-3 characters after the decimal point, which is called the extension.
For example: g9401 DBF, where g9401 is the primary name and DBF is the extension. The characters that can be used in the main name and extension of the file are:
(1) English letters: A-Z (case equivalent)
(2) Number: 0-9
(3) Chinese characters
(4) Special symbols: $& @ () – [] ^ ~, etc.
Space characters, various control characters and the following characters cannot be used in file names:
“. / (\<) x:;, *?
Because these characters have been used for other purposes.
Because some names have special meanings in DOS, we cannot use them as file names, such as:
Con – console (screen or keyboard)
COM1 – > asynchronous communication transmission port (serial port)
The naming of documents can be determined by the user, except that it shall generally comply with the agreement of DOS system. In order to facilitate management and memory, it is recommended to use the subject name and extension with certain meaning in English or Chinese pinyin.
If available, letter01 Txt indicates the letter with serial number 01, using gz9601 DBF represents the wage database of a unit in January 1996.
2.Polysemy file name and file name wildcard
A file name is usually used to specify a file. In practical use, sometimes it is necessary to process a batch of files at the same time. For example, to copy several files at a time or list a group of related file names, we can use the wildcard “?” And “*” so that you can easily achieve your goal.
(1) Character ‘?’: Indicates that it can be any character at this position.
(2) Character “*”: indicates that it can be any string from its position.

A file represented by a polysemy file name

*.DOC     test1.doc test2.doc
T*.*      test1.doc test2.doc temp1.dot temp2.d te1.6a
?R*.*     program1.prg program2.prg graph.img gra.img
PRO*.*    program1.prg program2.prg
G??.*     gl.dbf g.bas gra.img
GR?.*   gra.mg
TE??1.* te8t1.doc temp1.dot
TEST?.* t68t1.doc t68t2.doc
*.??      te1.ba letter
3.File extension
Some file extensions under DOS system have special significance, and some can be automatically generated by some specific software.
Special extension:

Extension Special definition
COM Executable file
EXE Executable file
BAT Batch file
SYS configuration system file

Software specific extensions:

Extension Specific software
BAK Backup files, such as old files retained by word processing software
BAS Program files generated by basic language
DBF Database files generated by dBASE (or FOXBASE) system
PRG Program files generated by dBASE (or FOXBASE) system
DOC Document file generated by word processing software
C Program files generated by C language

File directory
1.Tree directory
When a disk is initialized, a directory is established. This directory is called the root directory of the disk. We can put the files in the root directory in turn.
With the development of disk technology, the disk capacity is becoming larger and larger. It is no longer difficult for a disk to hold hundreds of files. However, putting a large number of files in the root directory will bring two problems:
First, the maximum number of files that the root directory established by DOS system can hold is limited. The root directory of 360kb disk can hold 112 files at most, and the 1.2MB and 1.44MB disks can hold 224 files at most; The second is to concentrate a large number of files in one directory, which is chaotic and inconvenient for users and DOS system to operate.
This is just like the library’s management of books: if the purchased books are numbered according to the purchase order, it will bring a lot of inconvenience to the search and other work. Therefore, the library divides the books into Chinese, mathematics, foreign language and other categories, and the Chinese category can be divided into primary school, middle school and other categories for management. Its shape is like an upside down tree.
Similarly, DOS system adoptsTree directoryStructure, that is, DOS system allows not only storing files in a directory, but also establishing its subordinate directory in a directory, which is called subdirectory; If necessary, the user can create a subordinate directory of the subdirectory in the subdirectory. In this way, on a disk, its directory structure may be composed of a root directory, several subdirectories and subdirectories of subdirectories.
With the tree directory structure, we often concentrate the files of the same application system in a subdirectory, or the files of the same type in a subdirectory, or set up different subdirectories for different users. Each person uses their own subdirectories without interfering with each other.
2.File identifier
With the tree directory structure, if you want to specify a file in a disk, you should not only give the file name of the file, but also give the path of the file – search path. When you want the computer to do something, you have to tell the computer where to get it and where to put it. It’s like writing the address of the recipient and the writer on the envelope instead of just your name. In DOS, the path refers to a group of directory names from the root directory (or current directory) to the specified file. If the first symbol in the path is a backslash (“\”), it represents the root directory. Each directory name is also separated from each other by a backslash (“\”),
On a microcomputer, several drives are often installed. In this way, to indicate a file during file operation, DOS must give the following three elements: drive letter, path and file name, which constitute the file identifier of a file. The general form of file identifier is:
“Drive letter”, “path] (file name)
The path and file name are also generally separated by a backslash (“\”).

According to the concept of file identifier, it is not difficult to understand:
(1) In the same directory (i.e. the same path), DOS does not allow two files with the same name.
(2) DOS allows two or more files to have the same name in different paths.
It is as if two rooms in the same building are not allowed to use the same number, but two rooms in different buildings are allowed to use the same number.
The DOS system treats the subdirectory as a special file when establishing it. Therefore, it should be pointed out that a subdirectory also has three elements: drive letter, path and subdirectory name. The general form of directory identifier is:
[drive letter] [path] (subdirectory name)
Paths and subdirectory names are also generally separated by backslashes (“\”).
On the disk where the tree directory is established, there are many different directories, including root directory, primary subdirectory, secondary subdirectory,…, one of which is called the current directory (for files, it is called the current path). So how to identify the current disk and current directory? If the DOS command prompt $p $g is executed (this command is introduced in the operating system), the first letter in the string of characters before the prompt “>” is the current disk, and the string of characters from the colon to the prompt “>” is the current directory.