A bit of history
MS/DOS is based on a system called QDOS developed in 1980 by Seattle Computer.
At the time QDOS was written, most microcomputers were based on 8 bit microprocessors: the Intel 8080 or Zilog Z80. These computers ran an operating system developed by Digital Research Corp. (no relation to DEC) known as CP/M.
QDOS was written for Intel's 16-bit microprocessor - the 8086. It attempted to provide a system for these machines that would be upwards-compatible with CP/M.
At about the same time, Digital Research produced its own 8086 version of CP/M, known as CP/M 86.
Microsoft Corporation purchased the rights to QDOS and developed it further, calling it MS (for Microsoft)/DOS. When IBM decided to develop a line of personal computers based on the Intel 8086, they considered both CP/M 86 and MS/DOS, but ultimately decided to use the latter - calling it PC/DOS on their systems.
MS/DOS has gone through a series of versions. Version 1 resembled CP/M very closely. Beginning with Version 2, Microsoft began incorporating ideas from Unix as well, and Version 3 began including support for networking. One consequence of this history is that there are often several ways of accomplishing the same function, since older mechanisms have been left in place for compatibility with older programs.
The original version of MS/DOS ran on Intel 8086/8088 microprocessors. These are 16 bit architecture chips, with 1 megabyte of address space based on a 20-bit address. Current versions run on machines built around 80386 and 80486 chips, which are 32-bit architecture with 4 gigabytes of address space.
The operating system itself, and may applications, run in a mode in which the CPU emulates the 16-bit 8086 architecture.
However, it is possible to take advantage of some of the 32-bit chip features in a restricted way. For example, Windows uses this to create a multi-tasking environment on top of DOS.
For simplicity, we will stick to describing a "vanilla" DOS environment as it might exist on any member of the PC line.
Structure: MS/DOS assumes that the underlying computer will consist of up to 640K of RAM, plus ROM that is preprogrammed by the manufacturer with drivers for the various IO devices present. MS/DOS partitions RAM into 6 regions:
TRANSPARENCY - MILENKOVIC P. 454
note on the interrupt vectors:
When an external device interrupts the 8086 processor, it must place an 8-bit interrupt type code on the system bus. This is used to index a 256 entry table to find the address of a service routine to handle the interrupt.
The instruction set of the 8086 includes an INT instruction which takes an 8-bit operand. This has the same effect as a device interrupt that puts that value on the bus.
MS/DOS uses certain of these interrupts for its own purposes - e.g. INT 21H is normally used to call most MS/DOS services. The remainder are available for hardware devices as the system manufacturer chooses.
Since there is no memory protection, application programs may redirect interrupts to go through them, rather than to the regular handler.
This allows "hot key" programs to work - they intercept the keyboard interrupt, look for their hot key, and pass control to the regular handler if any other key is struck.
This is also the mechanism used by viruses! For example, a common virus tactic is to intercept the "run a program" DOS system call in order to infect the program before it is run.
User -------------------------------------------- | COMMAND.COM | Utilities | Applications | | ---------------------------------------- | | | BDOS | | | | ------------------------------------ | | | | | BIOS | | | | | | -------------------------------- | | | | | | | Hardware | | | | --------------------------------------------
The Hardware inteface is provided by the BIOS, which supports basic functions such as reading data from the keyboard, writing data to the screen or a printer, and reading or writing a disk sector.
Normally, hardware is accessed only through BIOS - though a program can do so directly at cost of non-portability.
Normally, only the BDOS calls BIOS - though direct user calls to BIOS are possible - again at the cost of portability.
One of the reasons why the issue of "PC compatibility" has arisen in the microcomputer world is because a lot of PC software goes directly to the hardware, rather than going through BDOS and BIOS. This has been done for the sake of speed, but means that the software will only run on a system having the same hardware interface.
BIOS functions are called by placing parameters in specified CPU registers and then executing an INT (interrupt) instruction, which generates a software interrupt that is routed to the appropriate BIOS routine. The BIOS interrupts are all in the range 10H .. 1FH. For example, INT 10H is used for various video display operations; 13H for various disk operations; and 16H for various keyboard operations.
Program interface: BDOS functions are called like BIOS functions, but using interrupts in the range 20H .. 27H. (Most functions use INT 21H with a function code passed in a CPU register.)
COMMAND.COM: supplies A& prompt and accepts commands from terminal or from a simple batch facility
Some commands are built-in to COMMAND.COM - e.g. COPY, DELETE, DIR, TYPE etc. (These are called internal commands.)
Other commands are implemented by running a utility program included with MS/DOS - eg DISKCOPY, FORMAT, PRINT etc. (These are called external commands).
Application programs can be invoked by typing their name, provided an executable file name.COM or name.EXE resides on the disk.
Management interface: none
Runs on Digital Equipment Corp VAX family, which ranges from micro-VAX to the 9000 series including multi-processor and cluster systems. Though underlying hardware varies widely, the program and user interfaces are essentially the same across the spectrum.
Structure is much more complex, since VMS supports simultaneous batch, interactive (timeshared) and real-time processes, using virtual memory. We will come back to VMS at various times to illustrate these concepts. The basic memory organization looks like this to the user (but not physically, since the system uses virtual memory):
00000000H User program/data space - grows toward high memory ????????? (unused) ????????? 7FFFFFFFF User stack space - grows toward low memory ----------------------------------------------------------- 800000000 Operating system space - system service and library routines etc. FFFFFFFFF
Hardware: kernel of VMS contains drivers for various types of supported devices. A specific system is configured by a SYSGEN to include only the drivers needed for the devices it has. Supported devices include the following (from table of contents of IO User guide):
Various types of disk: RA60, RB02, RL02, RM03, RM05, RA80, RA81, RP05, RP06, RP07, RK06, RK07, RC25, RRD50 (CD Rom), RX01 (floppy), RX02 (floppy), TU58 (DECtape) etc.
Laboratory peripheral accelerator
Various line printers: LP11, LP27, LA11, LN01, LN03 Etc.
Magnetic tape: TM03, TS11, TM78, TU80, TU81, TA81, TK50 etc.
Mailboxes (virtual devices to be discussed later)
Terminals - accessed directly (console) or through multiplexers (DZ-11, DZ-32, DMF-32).
Program: Two levels:
VMS system services: provide functions like doing IO to/from a specific device, allocating additional memory, terminating a program, getting the time of day etc. etc. These are called like procedures through fixed addresses in system space.
RMS (file system) provides various file-oriented functions like looking up a record in an indexed-sequential file by key. These are called like procedures.
User: DCL - can process command input either from a terminal, a batch file, or a network connect. Numerous commands are provided, such as DIRECTORY, DELETE, RENAME, COPY, TYPE, PRINT, RUN etc.
User (Manager) DCL Applications Mgt. Utilities ------------------------------------------------- | | Acctg log | | -------------------------- | | RMS | | ------------------------------------ | | | System Svcs | | | | -------------------- | | | | | Kernel | | | | | | ------------ | | | | | | | Hardware | | | | -------------------------------------------------
Originally developed at Bell Labs in the 1970's on DEC PDP-11's. (The name is a play on the name of MULTICS - a multi-user operating system being developed at MIT.) Like VMS, Unix is a multi-user system. A distinctive of Unix is that it has been ported to a wide variety of CPU's, ranging from VAX's to micro-computers.
The name Unix is a trademark of AT&T. Unix-like systems have been developed under names like XENIX, XINU, ULTRIX etc.
One of the intended advantages of Unix is that it facilitates software portability across systems. Ostensibly, a Unix program written in a language like C can be compiled and run on any Unix system. However, this goal has been hindered by the existence of a variety of different versions of Unix.
At one point there were two main flavors of Unix:
Except for a few very low-level routines, all of Unix is written in C.
Hardware: like VMS, Unix has a kernel that includes drivers for the various kinds of devices present on the system. Installing Unix on a new system involves creating a configuration file listing the devices present on that system, then recompiling the Unix kernel to incorporate the needed drivers. VAX versions of Unix support essentially the same set of devices as does VMS.
Program: like VMS, the Unix kernel provides a family of system services that can be called like procedures by an application program. However, the Unix does not distinguish between basic system services and the file system, and its built-in support for various file organizations is much less sophisticated than RMS.
User: here is where Unix is distinctive
All interactive operating systems provide some sort of command interpreter to process user commands. In most systems, though, this interpreter is tightly linked to the rest of the system, for the following reasons:
When a user logs in, the command interpreter must gain control of his terminal and keep it until he types a command to run some program (utility or application).
Then, the command interpreter must "move aside" to allow the program to run.
When the program exits (by executing some sort of "exit program" system service), the command interpreter must gain control again.
This means that the command interpreter must be known by the system kernel, which gives it control when a user logs in or when a program exits. As a result, it has a special status not shared by utility and applications programs.
Under Unix, though, a command interpreter (called a "shell") is an ordinary program.
The password (user authorization) file contains, for each user, the name of the program that the system is to run for him when he logs in. For most users, this is either /bin/sh or /bin/csh - the so-called Bourne or C shells; but it can be any program, and a user can change his shell specification at any time by using the chsh command - provided the new shell is on a list of approved shells as established by the system manager.
When a shell needs to run a program, it takes advantage of a facility in Unix that allows any program to create a subprocess to run another program, with the first program being suspended until the program in the subprocess exits. Again, the shell program does not need to be known to the kernel in any special way; the facility it uses to run a program is available to any program.
Another related feature is the ability for a shell to run not one but several programs at the same time, with the output of one becoming the input of another. (This is called a pipeline.)
For example, suppose one had a paper he wished to spell-check against a dictionary file. One way to do this, of course, would be to write a special-purpose program. However, Unix allows a much quicker approach by taking advantage of a number of system utilities:
the transliterator utility - tr - can be invoked to discard punctuation marks in the file and to convert the spaces between words to carriage returns. The result would be all the words in the input file, one to a line.
the sort utility - sort - can be invoked to alphabetize the word list, discarding duplicates. The result would be all the words in the input file, one to a line in alphabetical order.
the file comparison utility - comm - can be invoked to compare this file to the dictionary file, reporting words that occur in the paper but not in the dictionary.
tr -cs A-Za-z0-9 '\012' < somefile | sort -fu | comm -23 - dictionary
Management: This is one of weaker features of Unix. The Unix system manager is called the superuser, and has access to all files and directories regardless of who owns them. Most system management tasks are done by editing appropriate files - e.g. /etc/passwd: the password file. Unix is sorely lacking in utilities for keeping track of system usage, disk quotas etc., though. As one writer described it: "VMS is the police state and Unix is anarchy."
$Id: msdos_vms_unix.html,v 1.2 1998/01/30 04:30:28 senning Exp $
These notes were written by Prof. R. Bjork of Gordon College. In January 1998 they were converted to HTML and lightly editited by J. Senning of Gordon College.