Disk Operating System (DOS)

An overview of DOS-based personal computers. Topics include: hardware components, operating systems, application software, user interface, booting, filing system, internal and external DOS commands, and how DOS finds commands.

Intro to PCs and DOS

Overview of Personal Computer Systems

A personal computer system consists of computer hardware and computer software working together.

  • Computer hardware is the system's mechanical and electrical components
  • Computer software (program) is a set of instructions

There are two major categories of software:

  • Operating Systems
  • Application programs

Computer Hardware Components

  • Input is the means by which we communicate data and instructions to the computer. Examples: keyboard, mouse, modem, scanner. (Digital camera, microphone, webcam).
  • Output is the way the computer communicates the results to us. Examples: monitor, printers, plotters, modem, speaker.
  • Primary storage (random access memory, or RAM) is where data and instructions are temporarily stored while the computer works with them. Physically, it is memory chips. RAM is said to be volatile, meaning that when the computer system is powered down, the contents of RAM is gone.
  • Secondary storage, also known as permanent storage, is where data and instructions are stored between computing sessions. Common types of permanent storage include magnetic media (floppy diskettes and hard disks), optical media (CDs and DVDs), and digital media (USB memory devices and others).
  • The microprocessor is the chip on the motherboard which controls processing. Its job is to analyze and execute program instructions. It performs arithmetic and logical operations and coordinates interaction between input, output, primary memory, and secondary storage devices.

Practical Hardware Tips

  • Turn on peripherals (printer and monitor, for example) first, and turn them off last. This helps protect expensive system unit components on the motherboard from voltage surges created when peripherals are powered up or down.
  • Never cycle the system unit on and off rapidly. This defeats the surge protection built into the power supply to protect chips and circuits.
  • A computer monitor has contrast and brightness controls, as well as controls for vertical and horizontal size and position. Normally, these controls should operate at their mid-points, which can be found by gently rotating the control from one limit to the other.
  • Monochrome monitors are prone to screen burn so do not leave images on them for long periods of time. Use a screen dimmer or turn down the brightness while you are away from the console.
  • Never place food or drink near keyboards or other peripherals.
  • Printers have an On/Off power switch and an On Line switch. In order to print, both must be On. The On Line switch makes the data connection between the computer and the printer.

Application Software

Computer software programs used to perform day-to-day work in the real world are known as application programs (applications). All applications run on top of an operating system, which provides them with common, essential services.
Examples of Applications:
  • Word processing. Letters, papers, manuals, books, etc. Type in text and move, copy, and delete it. Find and replace. Format text and print it.
  • Desktop publishing. Newsletters, manuals, books, etc. Combine text and graphic images and use sophisticated formatting techniques to prepare them for printing.
  • Spreadsheet. Financial models, ledgers, balance sheets, etc. Intersections (the cells) of its rows and columns can contain text, numbers, or formulas.
  • Database. Mailing lists, inventory, payroll, accounting, reservations, etc. Enter, store, and manipulate data. Retrieve data and display it.
  • Communications. Connect two or more computers for the exchange of data using phone lines. Requires the use of a modem at each end.
  • Graphics. Computer-Aided Design (CAD) for mechanical drawings and drawing programs for illustrations. Manipulate points, lines, geometric shapes, etc.
  • Utilities. Programs which enhance the operating system or applications: backup programs, memory managers, file maintenance tools, etc.

Operating Systems

To work properly (at all, actually), applications require the support of an operating system. On behalf of applications, an operating system carries out basic operations like controlling hardware resources and also operates the filing system used by all applications.

An operating system is a cooperative effort on the parts of:

  • Microprocessor microcode (instructions burned into the microprocessor)
  • ROM BIOS (chip on motherboard)
  • Operating system software (programs on disk)

Operating system software (OS) is a collection of specialized programs, which, together, manage:

  • Resources (hardware)
  • Processes (programs which are running)
  • Filing system

Before Windows, the main OS for IBM compatible personal computers was Disk Operating System, or DOS. While there were many "flavors" of DOS, the main ones were:

  • PC-DOS, IBM
  • MS-DOS, Microsoft

User Interface

A User Interface (UI) is a program running under the control of an operating system which allows the user to communicate with the operating system. An OS user interface is also known a shell.

In DOS, the UI is provided by COMMAND.COM. COMMAND.COM is also called the command processor, or command interpreter. The COMMAND.COM UI is a character-based (non-graphical) command line.

Communication between user and command interpreter is accomplished by typing commands into a command line. The DOS prompt (C:\>) signifies that COMMAND.COM is ready to process a command from the user. Once the command is typed and Enter is pressed, COMMAND.COM parses it and either delivers it to other operating system programs, or generates an error message if the command was not understood or could not be found.

In addition, COMMAND.COM:

  • Contains the DOS Internal Commands
  • Processes batch files

Booting the DOS Operating System

Loading an OS into memory is referred to as booting the computer. The operating system files must be found on either on the hard disk or a floppy disk in drive A:.

The sequence of events in the DOS boot is as follows:

  1. Instructions in ROM BIOS (Read Only Memory-Basic I/O Services) performs the Power On Self Test (POST). The POST determines whether hardware components, including the keyboard, the monitor, and RAM, are functional.

  2. If all hardware is working properly, the ROM BIOS checks the status of the computer's floppy and hard disk drives. If there is no diskette in drive A:, the BIOS looks at the first sector (side 0, cylinder 0, sector 1) on the first hard disk (C:) and looks for the Master Boot Sector, which contains the partition table and the Master Boot Record.


  3. BIOS reads the partition table which contains information about the logical division of the hard disk (partitions) and what operating systems are installed and which is active at boot time.

  4. BIOS executes the Master Boot Record, telling it which is the active operating system. The MBR uses the information to find the Boot Sector of the active partition and execute the Boot Record which is found there.

  5. The Boot Record, like the Master Boot Record, is a specialized program designed to launch another program. Exactly which program is launched by the boot record depends upon which operating system is booting. When installed, each operating system modifies the boot record in the boot sector of its own partition to launch the system file of its choice.

    The DOS boot record knows how to find and load into memory two Read- Only, Hidden, System files
    • MSDOS.SYS
    • IO.SYS
    MSDOS.SYS is the DOS kernel, its functions are:
    • File and record management
    • Memory management
    • Character device input/output
    • Spawning other programs
    • Access to real-time clock


    IO.SYS shares with BIOS responsibility for:
    • Console display and keyboard (CON)
    • Line printer (PRN)
    • Auxiliary device (AUX)
    • Date and time (CLOCK)
    Once MSDOS.SYS and IO.SYS are in memory, ROM BIOS is no longer in control. It does, however, continue providing basic, low level input/output functions to the operating system for use by application programs.

  6. IO.SYS reads the CONFIG.SYS file in the root of the boot drive if one is found (otherwise it uses default settings). CONFIG.SYS contains
    • Commands to load memory managers
    • Information on how memory should be configured
    • Information about installed hardware
    • Commands to load hardware drivers
    • Settings including number of file handles and buffers

  7. Next, IO.SYS loads COMMAND.COM from disk. In addition to supplying the User Interface, COMMAND.COM processes batch files, and it completes the boot process by finding and processing AUTOEXEC.BAT (automatically executing batch file). (AUTOEXEC.BAT must be found in the root directory of the boot disk).

    AUTOEXEC.BAT is a text file containing a set of commands to be carried out each time the computer is booted. It can include:
    • DOS internal commands (such as COPY and DEL)
    • External commands (load TSR's, other batch files, programs)
    • Create custom environmental variables like PROMPT, PATH, and SET

  8. Finally, the boot is complete, and COMMAND.COM displays a prompt on the command line to signify that the OS is loaded and ready to process commands. Typically, one would then enter the name of a DOS command to execute or an application to load.

While an application is running, the DOS kernel program (a part of MSDOS.SYS) watches over all of the ongoing processes, managing input/output and primary and secondary memory on behalf of the application. When the application (singular because DOS is single-tasking) requests the use of hardware resources (software interrupts) the kernel redirects the request to the rest of the operating system. When the user directs an application to save data to disk, the application requests filing services from the OS.

When the user terminates the application program, the OS reloads COMMAND.COM. COMMAND.COM then displays the DOS prompt to show that the system is once again ready for a command.

Making Disks Bootable

All disks must be formatted before they can be used. Formatting in DOS is done with the FORMAT command.

A disk format is a magnetic map on its surface: sectors (slices of pie) and tracks (concentric circles). After creating this magnetic grid, the DOS FORMAT program creates a File Allocation Table, or FAT. The FAT is the disk's table of contents. The format and the FAT are used by the DOS filing system to keep track of files on the disk.

If the disk is to be bootable, it must be a system disk, i.e. in addition to the filing system's format and FAT, it must also have system files and a boot record.

To format a system diskette:
FORMAT [d:] /s

To format non-system diskette:
FORMAT [d:]

The six components of a System Disk:
 

     FLOPPY
  1  Boot Sector           Always side 0, track 0, sector 0
       Boot Record         Loads operating system files

  1  HARD DISK
     Master Boot Sector    Always side 0, track 0, sector 0
       Partition Table     Contains location of active boot sector
       Master Boot Record  Activates active partition boot record        
     Boot Sector           Location varies, recorded in partition table
       Boot Record         Loads operating system files

  2  Hidden system files   IBMBIOS.COM and IBMDOS.COM
  3  Command interpreter   COMMAND.COM
  4  File Allocation Table An index to the location of all files
  5  Directory area        A file's status (is it deleted?)
                           Complete name and extensions
                           File attributes
                           Time and date stamps
                           The FAT entries
                           Files' sizes, in bytes
  6  Data tracks           Space for storage of data files

Hierarchic Disk Filing Structure

Using the DOS command MD (Make Directory), a disk can be logically divided into an organized hierarchy of directories and subdirectories (folders and subfolders in the Windows vernacular).

DOS provides this flexible and efficient method of dividing up disk space to make it possible to organize the huge number of files which can be stored on a hard disk.

A full file specification is a complete and unique description of where a file can be found in the hierarchic filing structure. It consists of a drive designation, a path, a file name, and a file extension:

[d:][path][filename][.ext]
  • The drive designation (letter followed by colon) refers to the drive on which the file is located
  • The path is a description of where on the drive the file is located
  • The filename: one-to-eight characters
  • File extension: one-to-three characters

Neither the filename nor extension can include reserved characters (?/\.:;,*<> and the space character).

Example: D:\DOCS\LETTERS\PERSONAL\TM_JUN89.DOC

The highest level directory is called the root directory. It is represented by the first \ (backslash) symbol in the file specification example above.

In addition to representing the root directory, the backslash is used to separate one directory from the next in the path description.

A directory's parent directory is the directory directly above it in the hierarchy. In the example above, DOCS is LETTERS parent, while the parent of DOCS is the root directory.

To copy, delete, or rename disk files it is necessary to identify them to DOS using their file specification. Example: to make a copy of TM_JUN89.DOC named TST_COPY.DOC, use this command:

C:\>COPY DOCS\LETTERS\PERSONAL\TM_JUN89.DOC DOCS\LETTERS\PERSONAL\TST_COPY.DOC

The DOS commands for working with directories are MD (Make Directory), CD (Change Directory), and RD (Remove Directory). CD is the command which allows us to navigate the disk structure.

Example: to make LETTERS the current directory, the command would be:

C:\>CD DOCS\LETTERS (Enter) C:\DOCS\LETTERS>

Note: spaces must be used appropriately because they are used as delimiters to show COMMAND.COM where one part of a command ends and the next begins.

Internal and External DOS commands

  • Internal commands. The instructions for internal commands are contained within the command interpreter, COMMAND.COM. Since COMMAND.COM is loaded into RAM when the computer is booted, they can be executed whenever the DOS prompt is present. Examples: COPY, DEL, REN, DATE, TIME, CLS, DIR


  • External commands. The instructions for external (transient) commands are stored on disk as program files. They always have the extension .EXE or .COM. To execute an external command COMMAND.COM must find the disk file. Examples: DISKCOPY, FORMAT, CHKDSK

  • Batch files. Batch files are disk files containing one or more DOS commands. We call for the execution of a batch file by typing its name at the DOS prompt and pressing Enter. If the batch file is found, the commands it contains are executed one after another just as if they were typed at the DOS prompt. Batch files (file extension .BAT), are extremely useful in automating frequently used command sequences.

All application programs have either an .EXE or .COM extension. Like the DOS external commands, they reside on disk and must be loaded into memory each time they are to be used. Exceptions are TSR (terminate-and- stay-resident) programs, which can be re-activated with a "hot-key" any time until the computer is shut off once they have been loaded into memory.

How DOS finds commands

When we give a command from the DOS prompt, DOS always uses the same algorithm to find the program we have requested. First, it searches COMMAND.COM's table of internal commands to see if the command is already in memory. If not, the command is assumed to be an external command and DOS uses the following steps in an attempt to find it on disk.

Always searching for the name of the command we typed, in the order of:

  1. THENAME.COM.
  2. THENAME.EXE.
  3. THENAME.BAT.
it looks in:
  1. The current directory of the current drive
  2. Each of the directories specified in the PATH statement

    The PATH statement is a list of places for DOS to look for program files when they cannot otherwise be found. The path statement puts the list into the
    DOS environment.

If unsuccessful, COMMAND.COM gives up and displays the error message

Bad command or file name.


Bruce Miller, 2002, 2014