520 likes | 592 Views
Understand the historical significance, basics of command-driven systems, processor sharing, and limitations of MS-DOS. Explore its development, design goals, and memory management. Discover how it paved the way for early Microsoft Windows releases.
E N D
Chapter 13MS-DOS Operating System Understanding Operating Systems, Fourth Edition
Objectives You should be able to describe: • The historical significance of MS-DOS • How MS-DOS provided a foundation for early Microsoft Windows releases • The basics of command-driven systems and how to construct simple batch files • How one processor can be shared among multiple processes • The limitations of MS-DOS for many of today’s computer users Understanding Operating Systems, Fourth Edition
MS-DOS Operating System • Developed to run single-user, stand-alonedesktop computers • Manages jobs sequentially from a single user • Advantages: • Fundamental operation • Straightforward usercommands • Disadvantages: • Lack of flexibility • Limited abilityto meet the needs of programmers and experienced users Understanding Operating Systems, Fourth Edition
History • MS-DOS was successor of CP/M operating system that ran first PC • Microsoft discovered an innovative operating system, called 86-DOS, designed by TimPatterson of Seattle Computer Products • Microsoft bought it, renamed it MS-DOS, and made it available to IBM • IBM chose MS-DOS in 1981, called it PC-DOS, and proclaimed it the standard fortheir line of PCs Understanding Operating Systems, Fourth Edition
History (continued) • MS-DOS became standard operating system for most 16-bit personal computers • Each version of MS-DOS is a standard version • Later versions are compatible with earlier versions • Early versions of Windows (versions 1.0 through 3.1) were merely GUIs that ran on top of the MS-DOS operating system • Although MS-DOS is no longer widely used, many Windows OSs offer a DOS emulator Understanding Operating Systems, Fourth Edition
History (continued) Table 13.1: The evolution of MS-DOS Understanding Operating Systems, Fourth Edition
Design Goals • Designed to accommodate single novice user in single-processenvironment • Standard I/O support includes keyboard, monitor, printer, and secondary storage unit • User commands are based on English words or phrases, interpreted by command processor • Layering approach is fundamental to design of the whole MS-DOS system Understanding Operating Systems, Fourth Edition
Design Goals (continued) Figure 13.2: The three layers ofMS-DOS Understanding Operating Systems, Fourth Edition
Design Goals (continued) BIOS (Basic Input/Output System): • Interfaces directly with various I/O devices • Contains device drivers that control flow of data to and from each device except disk drives • Receives status informationof each I/O operation and passes it on to processor • Takes care of small differences among I/O units • Example: Allows user to purchase a printer from any manufacturer without having to write a device driver Understanding Operating Systems, Fourth Edition
Design Goals (continued) DOS kernel: • Contains routines that interface with disk drives • Read into memory at initialization time from MSDOS.SYS fileresiding in boot disk • Accessed by applicationprograms and provides collection of hardware-independent services, such as: • Memorymanagement and file and record management • Compensates for variations from manufacturer to manufacturer Understanding Operating Systems, Fourth Edition
Design Goals (continued) DOS kernel: (continued) • Makes disk file management transparent to user • Manages storage and retrieval of files • Dynamically allocates and deallocates secondary storage as it’s needed Understanding Operating Systems, Fourth Edition
Design Goals (continued) Command processor (the shell): • Sends prompts to user • Accepts commands that are typed in • Executes commands, and issues appropriate responses • Resides in a file called COMMAND.COM, which consists of two parts, stored in two different sections of main memory • Only part of OS that appears on the public directory • Weakness: It isn’t interpretive Understanding Operating Systems, Fourth Edition
Memory Management • Memory Manager manages single jobfor single user • To run second job, user must close or pause first file beforeopening second • Uses first-fit memory allocation scheme • Main memory comes in two forms: • ROM: Very small in size and contains a program, a section of BIOS, with the the startup process (bootstrapping) • RAM:Part of the main memory where programs are loaded and executed Understanding Operating Systems, Fourth Edition
Memory Management (continued) Figure 13.3: One megabyte of RAM main memory in MS-DOS.The interrupt vectors arelocated in low-addressablememory and COMMAND.COM overlay islocated in highaddressablememory. Understanding Operating Systems, Fourth Edition
Main Memory Allocation • MS-DOS Version 1.0gave all available memory to resident applicationprogram • MS-DOS Version 2.0 began supporting dynamic allocation,modification, and release of main memory blocks by application programs • Amount of memory each application program actually owns depends on: • Type of file from which program is loaded • Size of TPA Understanding Operating Systems, Fourth Edition
Main Memory Allocation (continued) • Programs with COM extension are given all of the TPA, whether or not they need it • Programs with EXE extension are only given amount of memory they need • Except for COM files, there can be any number of files in TPA at one time • Two programs can’t be run at same time • Shrinkingand expanding of memory allocation during execution can be done only fromprograms written in either assembly language or C Understanding Operating Systems, Fourth Edition
Memory Block Allocation • Memory Manager allocates memory by using first-fit algorithm and linked listof memory blocks • Best-fit or last-fit strategy canbe selected with Version 3.3 and beyond • When using last-fit, DOS allocates highest addressable memory blockbig enough to satisfy program’s request • Size of a block can vary from as small as 16 bytes (called a “paragraph”) to aslarge as maximum available memory Understanding Operating Systems, Fourth Edition
Memory Block Allocation (continued) Table 13.2: First five bytes of a memory block define block’s structuralcharacteristics Understanding Operating Systems, Fourth Edition
Memory Block Allocation (continued) Table 13.3: A sample memory blockwith first five bytescontaining 7700000004h Understanding Operating Systems, Fourth Edition
Memory Block Allocation (continued) • When a memory request comes in: • DOS looks through free/busy block listuntil it finds a free block that fits request • A well-designed application program releases memory block it no longer needs • Iftwo free memory blocks are contiguous, they are merged immediately into one blockand linked to the list Understanding Operating Systems, Fourth Edition
Memory Block Allocation (continued) Figure 13.4: The linked list of memoryblocks Understanding Operating Systems, Fourth Edition
Processor Management • MS-DOS doesn’t support reentrant code (basis for multitasking) • Programs can’t break out of middle of DOS internal routine and thenrestart routine from somewhere else • Each job runs in complete segments and is not interrupted midstream • Interrupt handlers allows the saving of all information about parent program that allows its proper restart after child program has finished Understanding Operating Systems, Fourth Edition
Interrupt Handlers • Responsiblefor synchronizing processes • A personal computer has 256 interrupts and interrupthandlers, accessed via interrupt vector table • Interrupts can be divided into three groups: • Internal hardware interrupts • External hardware interrupts • Software interrupts Understanding Operating Systems, Fourth Edition
Interrupt Handlers (continued) • Internal hardware interrupts: Generated by certain events occurring during program’s execution, e.g., division by zero • Assignment of such events to specific interrupt numbers is electronically wired into processor • Not modifiable by software instructions Understanding Operating Systems, Fourth Edition
Interrupt Handlers (continued) • External hardware interrupts: Caused by peripheral device controllers or by coprocessors • Assignment of external devices to specific interrupt levels is done by manufacturer • Can’t be modified by software • Implemented as physical electrical connections • Software interrupts: Generated by system and application programs • Access DOS and BIOS functions Understanding Operating Systems, Fourth Edition
Interrupt Handlers (continued) • Software interrupts: (continued) • Some are used to activate specialized application programs thattake over control of computer • Example: Borland’s SideKick (type of TSR) • Terminate and Stay Resident (TSR)interrupt handler: • Terminates process without releasing its memory • Usually used by subroutine libraries • When running, it sets upmemory tables and prepares for execution by connecting to DOS interrupt Understanding Operating Systems, Fourth Edition
Interrupt Handlers (continued) Interrupts synchronization: • When CPU senses interrupt, it does twothings: • Puts contents of PSW (program status word), codesegment register, and instruction pointer register on a stack • Disables interruptsystem so that other interrupts will be put off until current one has been resolved • CPU uses 8-bit number toget address of appropriate interrupt handler • Interrupt handler reenables interrupt system to allow higher-priorityinterrupts to occur Understanding Operating Systems, Fourth Edition
Device Management • Requests are handledfirst-come, first-served • Does not support reordering requests, though in Version 3.0, BIOS can support spooling • MS-DOS Device Manager can work withmagnetic tape, floppy disks, or hard disks • BIOShandles device driver software • Device drivers are only items needed by Device Manager to make system work • Installable device drivers are salient feature of MS-DOS design Understanding Operating Systems, Fourth Edition
File Management • MS-DOS supports following file organizations: • Sequential • Can have either variable or fixed-length records • Direct • Can only have fixed-length records • Indexed sequential • Can only have fixed-length records Understanding Operating Systems, Fourth Edition
Filename Conventions • A filename: • Contains no spaces • Consists of drive designation, directory, anysubdirectory, a primary name, and an optional extension • DOS isn’t case-sensitive • Drive name is followed by a colon (:) • Directories or subdirectories can be from one to eight characters long and preceded by a backslash • Primary filename can be from one to eight characters long Understanding Operating Systems, Fourth Edition
Filename Conventions (continued) • Extension can be from one to three characters long and can have special meaning • File is assumed in current working directory if no directories or subdirectories are included in name • File is assumed on current drive if no drive is designated • Relative name consists of primary name and extension • Absolute name consists of drive designation and directory location Understanding Operating Systems, Fourth Edition
Managing Files • Earliest versions kept every file in single directory • Slowand cumbersome file retrieval • Microsoft implemented hierarchical directory structure in Version 2.0 • An inverted tree directory structure (root at top) • Disk tracks are divided into sectors of 512 bytes each when formatted • Corresponding to buffer size of 512 bytes • Concept of cylinders, applies to hard disks Understanding Operating Systems, Fourth Edition
Managing Files (continued) • Sectors (from two to eight) are grouped into clusters • When a file needs additional space, DOS allocatesmore clusters to it • FORMAT creates three specialareas on disk: • Boot record • Root directory • FAT(file allocation table) Understanding Operating Systems, Fourth Edition
Managing Files (continued) • Boot records:First sector of every logical disk and contains: • Disk boot program • Table of disk’s characteristics • Root directory: Where system begins its interaction with user and contains: • List of system’s primary subdirectories and files • Any system-generated configuration files • Any user-generated booting instructions Understanding Operating Systems, Fourth Edition
Managing Files (continued) • Root Directory (continued): • AUTOEXEC.BAT file: Batch file containing series of commands defined by user • Every time CPU ispowered up, the commands in this file are executed automatically by system • The information kept in root directory include: • Filename, File extension • File size in bytes • Date and time of the file’s last modification • Starting cluster number for the file • File attribute codes Understanding Operating Systems, Fourth Edition
Managing Files (continued) • Root Directory (continued): • Number of entries in root directory is fixed • Version 2.0 and onward versions allow users to avoidthis limitation by creating subdirectories • Each subdirectory can contain its own subdirectories and/or files • MS-DOS supports hidden files • Files that are executable but not displayed in responseto DIR commands • COMMAND.COM is the only system file that isn’t hidden Understanding Operating Systems, Fourth Edition
Managing Files (continued) Figure 13.5: An example of directory listing of a rootdirectory Understanding Operating Systems, Fourth Edition
Managing Files (continued) Figure 13.6: Typical directory system Understanding Operating Systems, Fourth Edition
Managing Files (continued) • File Allocation Table (FAT): Contains status information about disk’s sectors • Status includes, which sectors are allocated, free, and can’t be allocated because offormatting errors • All sectors except first are linked in a chain • EachFAT entry gives sector/cluster number of next entry • Last entry contains value FF to indicate end of chain Understanding Operating Systems, Fourth Edition
Managing Files (continued) Figure 13.7: A typical FAT Understanding Operating Systems, Fourth Edition
Managing Files (continued) • MS-DOS views data in disk file as continuous string of bytes • I/Ooperations request data by relative byte (relative to beginning of file) ratherthan by relative sector • MS-DOS supports noncontiguous file storage • Dynamically allocates disk space to file • Compaction became feature of MS-DOS Version 6.0 with inclusion ofDEFRAG.EXE • CHKDSK (filename) responds with number of noncontiguous blocks in which file is stored • Security feature is not built into MS-DOS Understanding Operating Systems, Fourth Edition
User Interface • MS-DOS uses command-driven interface • Users type in commands at system prompt • Defaultprompt is drive indicator and > character • Default prompt can be changed using PROMPT command • User commands include some or all of following elements in this order: • Command, source- file, destination-file, switches Understanding Operating Systems, Fourth Edition
User Interface (continued) • Switches are optional and give specific details about how command is to be carried out • Begin with slash (i.e., /P/V /F) • COMMAND.COMcarries out commands • Resident portion of code: Stored in low section of memory • Contains command interpreter and routines needed to support an active program • Transient code: Stored in highest addresses of memory • Can be overwritten by application programs if they need to use its memory space Understanding Operating Systems, Fourth Edition
User Interface (continued) Table 13.4: MS-DOSuser commands Understanding Operating Systems, Fourth Edition
User Interface (continued) Table 13.4 (continued): MS-DOSuser commands Understanding Operating Systems, Fourth Edition
Batch Files • Customized batch files allows users to quickly execute combinations of DOScommands to: • Configure systems • Perform routine tasks • Make it easier fornontechnical users to run software • For such programs to run automatically every time system is restarted: • File shouldbe renamed AUTOEXEC.BAT and loaded into system’s root directory Understanding Operating Systems, Fourth Edition
Redirection • MS-DOS can redirect output from one standard input or output device to another • Syntax: command > destination • e.g., DIR > PRN sends directory listing to printer instead of monitor screen • Append Symbol (>>) redirect and append new output to an existing file • e.g., DIR >> B:DIRFILE • Redirection works in opposite manner as well • Symbol (<) changes source to a specific device or file. e.g., INVENTRY < B:TEST.DAT Understanding Operating Systems, Fourth Edition
Filters • Filter commands:Accept input from default device, manipulate data in somefashion, and send results to default output device • Example: SORT • Can read data from file and sort it to another file • Sorted in ascending order • SORT /R sorts file in reverse order • Files can be sorted by columns • Example: MORE • Causes output to be displayed on screenin groups of 24 lines, one screen at time Understanding Operating Systems, Fourth Edition
Pipes • Causes standard output from one command to be used as standard inputto another command • Symbol: Vertical bar (|) • e.g.,DIR | SORTalphabetically sort directory and display sorted list on screen • Pipes and other filters can be combined • Possible to sort directory and display it one screen at a time by using pipecommand: DIR | SORT | MORE Understanding Operating Systems, Fourth Edition
Additional Commands • FIND: Searches for specific string in given file or files and displays all lines that contain the string from those files • e.g., FIND "AMNT-PAID" PAYROLL.COB display all lines in the file PAYROLL.COB that contain string AMNT-PAID • PRINT: Allows user to set up series of files for printing while freeing up COMMAND.COM • PRINT /B allows changing of internal buffer size • PRINT /Q specifies the number of files allowed in print queue Understanding Operating Systems, Fourth Edition