Mercy Lou H. Mercy Lou H. Yecla Yecla
May 24, 2015
Mercy Lou H. YeclaMercy Lou H. Yecla
MS-DOSMS-DOS
o HistoryHistoryo Design GoalsDesign Goalso Memory ManagementMemory Managemento Processor ManagementProcessor Managemento Device ManagementDevice Managemento File ManagementFile Managemento User InterfaceUser Interfaceo Additional CommandsAdditional Commands
MS-DOS, PC-DOS or DOS:MS-DOS, PC-DOS or DOS: Microsoft Disk Operating SystemMicrosoft Disk Operating System
o Developed to run single-user, stand-alone desktop computers. Exemplifies early Operating Systems because it manages jobs
sequentially from single user. o Advantages: Simple operation & straight-forward user
commands. o Disadvantages:
1. Lack of flexibility & limited ability to meet needs of programmers & experienced users.
2. Written for a single family of microprocessors (Intel family of chips: 8086, 8088, 80186, and 80286).
History of DOSHistory of DOS
History of DOS (cont)History of DOS (cont)
Design GoalsDesign Goalso Accommodate single novice user in single-
process environment.o Standard I/O support includes keyboard,
monitor, printer, & secondary storage unit. o User commands are based on English
words/phrases indicative of action to be performed.
o Commands are interpreted by command processor.
o Layering approach “protects” user from hardware.
MS-DOS ArchitectureMS-DOS ArchitectureUser
Hardware
COMMAND.COM
DOS Kernel
BIOS
MS-DOS
First 2 DOS Layers : BIOS & First 2 DOS Layers : BIOS & KernelKernel
1. BIOS (Basic Input/Output System) -- interfaces directly with various I/O devices. Device drivers (control flow of data to/from each device). Receives status info about success/failure of each I/O operation & passes
it on to the processor.
2. DOS kernel -- routines needed to interface with the disk drives. Read into memory at initialization time from MSDOS.SYS file on boot
disk. Accessed by application programs. Provides a collection of hardware-independent services, such as memory
management, & file & record management (system functions).
Third DOS Layer : Command Third DOS Layer : Command ProcessorProcessor
3. Command processor (shell) -- sends prompts to user, accepts commands, executes commands, & issues appropriate responses. Resides in a file called COMMAND.COM, which consists of 2 parts stored
in 2 different sections of main memory. Not interpretive. MS-DOS Version 4.0 -- menu-driven DOS shell. OS/2 -- designed to replace MS-DOS.
o MS-DOS ran enormous collection of software packages making it difficult to discontinue.
DOS Memory ManagementDOS Memory Management
o Memory Manager – Relatively simple job because it’s managing single
job for single user. – Uses a first-fit memory allocation scheme since it
is most efficient strategy in a single-user environment.
DOS Main Memory DOS Main Memory AllocationAllocation
o First versions had simple contiguous memory allocation scheme that gave all of the available memory to resident application program. Applications couldn’t dynamically allocate memory blocks. MS-DOS Version 2.0 supported dynamic allocation, modification, & release of main
memory blocks by applications.o Amount of memory each application owns depends on type of file from
which program is loaded & size of TPA. Programs.COM -- given all of TPA, whether or not they need it. Programs.EXE -- given amount of memory they need.
Memory Block AllocationMemory Block Allocation
o Allocates memory by using first-fit algorithm & linked list of memory blocks.
o With Version 3.3, MS-DOS started using best-fit or last-fit strategy.
o Size of a block can vary from 16 bytes (paragraph) to maximum available memory.
Free/Busy Block ListFree/Busy Block List
o Whenever request for memory comes in, DOS looks through free/busy block list to find free block that fits. If list becomes disconnected, system stops & must be rebooted.
o Well-designed application program releases memory block it no longer needed.
Process ManagementProcess Management
o MS-DOS doesn’t support multitasking. Programs can’t break out of middle of DOS internal
routine & restart routine from somewhere else. There's no interleaving & no need for sophisticated
algorithms or policies to determine which job will run next or for how long.
Interrupt HandlersInterrupt Handlers
o Interrupt Handlers - are Responsible for Synchronizing Processeso PC has 256 interrupts & interrupt handlers, & they are accessed via
interrupt vector table.o Three types of interrupts:1. Internal hardware interrupts -- generated by certain events occurring
during program’s execution (e.g., division by zero). 2. External hardware interrupts -- caused by peripheral device controllers
or by coprocessors & assigned by manufacturers.3. Software interrupts -- generated by system & application programs to
access DOS & BIOS functions, which, in turn, access system resources.
Interrupt Handlers Interrupt Handlers (cont)(cont)
• Software interrupts (continued) – Some activate specialized application programs
• Take control of computer• Example: Borland’s SideKick (type of TSR)
– Terminate and Stay Resident (TSR) interrupt handler• Terminates process without releasing memory• Used by subroutine libraries• Sets up memory tables • Execution preparation via DOS interrupt connection• Determines memory required• Sends return code back to parent
Interrupt Handlers Interrupt Handlers (cont)(cont)
• Interrupt synchronization– CPU senses interrupt
• Puts on stack: contents of PSW (program status word), code segment register, and instruction pointer register
• Disables interrupt system• Uses eight-bit number to obtain interrupt handler
address• Interrupt handler reenables interrupt system: allows
higher-priority interrupts to occur• Saves registers and processes interrupt
Device ManagementDevice Management
o Ability to reorder requests to optimize seek & search time is not a feature of DOS because it’s designed for a single-user environment. All requests are handled on a first-come first-served basis. Since version 3.0, BIOS can support spooling so users can schedule
several files to be printed one after the other.o MS-DOS written for simple systems using keyboard, monitor, printer,
mouse, 1-2 serial ports, & maybe second printer. Devices do not require special management from OS. Device drivers are the only items needed by Device Manager to make
system work. A device driver is a software module that controls an I/O device and
handles its interrupts.
Managing FilesManaging Files
o Earliest versions of MS-DOS kept every file in a single directory. o Version 2.0 implemented hierarchical directory structure.o When disk is formatted, its tracks are divided into sectors of 512 bytes. o 2-8 sectors are grouped into clusters & that's how File Manager allocates
space to files.
FORMAT Creates Three FORMAT Creates Three Special Areas on DiskSpecial Areas on Disk
1. Boot record -- first sector of every logical disk & contains disk boot program & table of disk's characteristics.
2. Root directory -- Lists system’s primary subdirectories & files (name, extension, size, date & time of modification, starting cluster #, file attribute codes).
3. FAT (File Allocation Table) -- contains status info about disk’s sectors: which are allocated, which are free, and which can’t be allocated because of errors.
Managing Files in DOSManaging Files in DOS
o Supports noncontiguous file storage & dynamically allocates disk space to a file, provided there’s enough disk room.
o Compaction (MS-DOS Version 6.0) available via utility used to defragment disk (DEFRAG.EXE).
o CHKDSK command used to determine need for compaction.o Restricting user access to computer system & resources isn’t
built into MS-DOS.
User InterfaceUser Interface
o Command-driven operating system.
o When user presses Enter key, shell (COMMAND.COM) interprets command & calls on next lower level routine to satisfy request.
o User commands include some or all of these elements in this order:
command source-file destination-file switches
Batch Files & RedirectionBatch Files & Redirection
o By creating customized batch files, users can quickly execute combinations of DOS commands to configure their system, perform routine tasks, or make it easier for non-technical users to run software.
o MS-DOS can redirect output from one standard input or output device to another.
command > destinationE.g., dir > PRN
Filter CommandsFilter Commands (SORT, MORE) (SORT, MORE)
o Filter commands accept input from default device, manipulate data in some fashion, & send results to default output device.
o SORT accepts input from keyboard, sorts that data, & displays it on screen. Sort the file by column.
o MORE causes output to be displayed on screen in groups of 24 lines, one screen at a time, & waits until user presses Enter key before displaying next 24 lines.
PipePipe• Cause standard output from one command to be used as standard
input to another command.– Symbol is a vertical bar, |. – Alphabetically sort directory & display sorted list on screen:
DIR | SORT • Combine pipes and other filters.
TYPE INVENTRY.DAT | MORE MORE < INVENTRY.DAT
DIR | SORT | MOREDIR | SORT > SORTFILEMORE < SORTFILE
SummarySummary
• MS-DOS – Written to serve 1980s personal computer users
• Limitation– Limited flexibility– Operating system unusable as hardware evolved
• First standard operating system– Adopted by personal computing machine
manufacturers– Supported by legions of software design groups
Summary (continued)Summary (continued)
• Advantages – Fundamental operation– Straightforward user commands
• Weakness – Design
• Single-user/single-task systems
– No multitasking, networking, sophisticated applications support