Title: DOS
1DOS
2DOS is Dead!
- A exam does not cover DOS, so why am I studying
this stuff? - A still assumes you understand all the commands
in this chapter - A does test you on DOS memory usage and
configuring DOS programs within Windows - Some concepts will be easier to understand if you
know a little about DOS to begin with - If youre using Windows, go to a command prompt
(Start ? Programs ? Accessories ? Command Prompt
or Start ? Run ? Command or Cmd)
3Operating Systems
4Need for an Operating System
- Characteristics of an operating system
- An operating system works with a particular type
of processor. - It always starts after POST, taking control of
the PC. - The maker of the OS provides a rule book that
tells programmers how to write programs for their
OS. The rule book is called application
programming interfaces (APIs)
5Communicating with the Hardware
- The operating system works with the system BIOS
to communicate with the basic devices. - Most recent operating systems skip the BIOS and
talk directly to hardware - Operating systems use device drivers to
communicate with hardware devices.
6Creating a User Interface
- A computers user interface provides the user a
display of the programs and data on the PC. - The user interface should be flexible and
scalable, depending on the system on which it is
installed.
7Accessing and Supporting Programs
- An operating system must
- Enable users to start a program.
- Provide access to the hardware while the
application runs. - Provide a way to either stop the program, or
generate an error message if a program loses
control. - Return to the user interface once an application
shuts down.
8Programs and Data
- The operating system should provide a label for
each program and each individual piece of data. - It should provide a naming system for all the
drives. - The user should be able to store data and
programs in distinct groups. - The operating system user interface must be able
to interact with each of these groups to open or
close them or to copy, move, or delete programs
or data.
9DOS
10DOS Concepts
- DOS is a single-tasking operating system designed
to run on an 8086 processor - It is text based
- Does not support mice
- Completely case insensitive
11Files
- DOS manifests each program and piece of data as
an individual file - Each file has a name that consists of two parts
the filename and the extension which are
separated by a dot - 8.3 filenames
- Cannot use / \ lt gt , ?
- The extension defines the file as an executable
(EXE), command (COM), batch (BAT), or data file.
Data files have extensions that associate them
with the program that created them. - Files are stored in a binary format
12ASCII
- Most programs store their data in their own
special format - American Standard Code for Information
Interchange (ASCII) is a special file format that
can be read by any program. - The ASCII standard defines 256 eight-bit
characters. - DOS treats the first 32 ASCII characters as
special commands. - ASCII files are known as text files
13ASCII Table
14Drives and Directories
- DOS uses a hierarchical directory tree to
organize the contents of the drive. - Directories are groups in which files are placed.
- Windows calls directories folders
- Subdirectories are directories inside
directories. - Two files or subdirectories under the same
directory cannot have the same name.
15Drives and Directories
- Subdirectories in a directory are displayed by
adding backslashes and names. - A path represents the exact location of a file.
- Directories make organization of files easier.
C\ represents the root directory of drive
C C\DOS represents the subdirectory DOS on
drive C C\DOS\IO.SYS represents the path to the
file IO.SYS
16DOS Structure
- The DOS operating system is composed of three
main files - IO.SYS It handles communication between the
BIOS and the hardware. - MSDOS.SYS It is the primary DOS code.
- COMMAND.COM It interprets the commands typed
into the PC, and passes the information to
MSDOS.SYS. - DOS includes many additional auxiliary files that
are stored in C\DOS (or c\windows\command in
Windows 9x)
17The DOS Prompt
- The prompt is a path followed by a greater-than
sign and a flashing cursor. - The prompt indicates the directory on which DOS
is currently focusing.
18DOS Commands
- The DIR command lists the contents of a
particular directory. - The DIR/W command only lists the names of the
files. - The /? is used to invoke the help screen for a
particular command.
19DOS Commands
- The CD (or CHDIR) command is used to change the
focus to a different directory. - The CD\ command is used to return to the root
directory. - To switch between drives, type the drive letter
followed by a colon.
20DOS Commands
- The MD (or MKDIR) command is used for creating a
directory. - The DEL command is used for deleting files, and
the RD (RMDIR) command is used for deleting
directories and subdirectories. - The DELTREE command is used for deleting
directories containing files and subdirectories.
21Running a Program
- To run a program
- Change the DOS focus to the directory where the
program is stored. - Type the filename without its extension and press
ENTER.
22Using Function Keys
- F1 function key brings back the previous command
one letter at a time - F3 function key brings back the entire command at
once - The DOSKEY command stores a list of all
previously typed commands and can be accessed by
using the up arrow key. - Type DOSKEY to start the program
- Windows 2000 automatically starts the program
23Working with Files
- Attributes (H, R, S, A) are special values
assigned to a file. - Hidden hides the file from DIR
- Read-only protects a file from being deleted or
modified - System identifies system files like IO.SYS
- Archive identifies files that have not been
backed up - The ATTRIB.EXE program is used to inspect and
change file attributes.
24Working with Files
- Wildcards
- Wildcards are special characters that enable DOS
commands to act on more than one file at a time. - represents any number of characters
- ? represents a single character
25Working with Files
- The DEL and ERASE commands are used for deleting
files. - The RD and DELTREE commands are used for deleting
directories. - The COPY command is used for making a copy of the
file in a new location. - The MOVE command is used for moving the file from
its original location to a new one. - The XCOPY command is used for working with
multiple directories.
26DOS in a Windows Environment
- Windows 9x and Windows 2000 use COMMAND.COM and
CMD.EXE respectively, to invoke the command
prompt. - CMD.EXE is a more advanced command processor in
Windows 2000
27DOS in a Windows Environment
- Boot modes in Windows 9x
- The Windows startup menu option can be used to
invoke the command prompt - When you see Starting Windows 9x press the F8
function key to bring up the Startup menu - The Restart in MS-DOS Mode option from the
Shutdown menu option can be used for booting to a
command prompt.
28DOS in a Windows Environment
- Boot modes in Windows 2000
- Windows 2000 does not have a Command Prompt
option but you can boot to a Safe Mode Command
Prompt - Win2K uses the Recovery Console feature to handle
boot problems. - To use a command prompt in Windows 2000 run
command.exe (16-bit) or cmd.exe (32-bit)
29Communicating with the Hardware
- DOS talks to hardware thru the BIOS
- The BIOS knows how to communicate with basic
devices in the PC - If a new device is added, the BIOS may not know
how to talk to it - DOS provides two ways to add more code so that
DOS will know how to talk to new hardware beyond
the BIOSs knowledge - Device drives in config.sys
- TSRs in autoexec.bat
30Device Drivers and CONFIG.SYS
- A device driver is a special file that contains
the programs necessary to communicate with a new
device - The drivers are loaded through a special file
called CONFIG.SYS - Copy the device driver file to the hard drive
- All a device or devicehigh line to the
config.sys file with the location of the file
following the sign - To comment out a line in config.sys preface with
- Changes to config.sys do not take effect until
you reboot the PC - DOS comes with many device drivers, two of the
most useful ones being SETVER.EXE and ANSI.SYS
31DOS Device Drives
- Setver.exe
- Tells DOS to pretend to be whatever version you
tell it, which helps some programs run properly - Devicec\dos\setver.exe
- Ansi.sys
- Enables you to add color and features to the
prompt - Enables you to remap the keyboard
- Devicec\dos\ansi.sys
32Device Drivers and CONFIG.SYS
- Configuring commands in CONFIG.SYS
- BUFFERS It defines the size of the buffer
space. - STACKS It is the memory set aside by DOS for
storing the register information temporarily. - FILES DOS sets aside some memory to keep track
of all the files on the hard drive that are being
used. The memory used for one file is called a
file handle. - SHELL The SHELL statement defines the shell
that DOS uses.
33Configuration Commands in Config.sys
- Buffers set aside some space that DOS needs for
disk I/O. The default is 15. - Buffersnn,m where nn is the number of buffers
and m is the number of buffers in the look-ahead
buffer - Stacks is an area DOS uses to store register
information temporarily. If a program is running
and a device sends an interrupt, DOS needs to use
the register space. So DOS moves the program
usage of the registers out temporarily to the
stack - Stacksnn,mm where nn is the number of stacks
and mm is the size of each stack - Increase the values if you get a Stack Overflow
error
34Configuration Commands in Config.sys
- Files is used to increase the number of file
handles. DOS keeps track of files being used at
any given timeone file handle per file. The
default value is 8 but is usually not enough - Filesn where n is the number of file handles
- Shell defines which command.com to use
- Shellc\dos\command.com /P /E512
- See DOS Help for more information
35TSRs and AUTOEXEC.BAT
- The (Terminate and Stay Resident) TSR program
also provides support for devices - A TSR will immediately return you to a DOS prompt
(terminate) but will still be in RAM (stay
resident) - DOSKEY.COM is a TSR program that keeps track of
typed commands, creates keyboard macros, and adds
extra power to the function keys for typed
commands - The MODE.COM program is used for configuring and
redirecting ports and may be used to change the
look of the monitor
36TSRs and AUTOEXEC.BAT
- The AUTOEXEC.BAT is a text file that gets
executed each time the system reboots. - The SET command creates environment variables for
DOS programs. - The PATH environment variable specifies the
location of programs, which are not in the
current directory. - The PROMPT command defines the look of the prompt.
37TSRs and AUTOEXEC.BAT
- The F5 and F8 keys are used to either completely
override, or step line by line through the
CONFIG.SYS and AUTOEXEC.BAT files. - Batch files enable automation of a series of
prompt commands. - Just save the file with a BAT extension
38Making a Boot Disk
- A boot disk is a vital tool!
- You may make a boot disk from any properly
running PC (make one for every version of DOS
youll need to work with)
39Working with Drives
- VOL - A volume label enables users to create
descriptive names for the drives. - VOL lets you view the volume name
- LABEL lets you change the volume name
- SYS - The SYS command copies the three DOS system
files to a partition, making it bootable. - LASTDRIVE - The LASTDRIVE command is used for
allocating memory for the drive letters of
storage devices other than the hard drive.
40Working with Drives
- DOS provides utilities to inspect, optimize, and
repair devices. - The CHKDSK program is used for identifying and
repairing lost cluster chains. - A lost cluster is a cluster that does have a
proper link or filename - CHKDSK identifies and repairs lost clusters by
placing them in the root directory as
FILExxxx.CHK - A cross-linked file is when two files are
claiming the same space on the drive - CHKDSK identifies but cannot repair cross-linked
files
41Working with Drives
- Scandisk
- Repairs lost clusters, cross-linked files,
directory and file structures, file allocation
tables, and volume labels
- Defrag
- Simple defragmentation program that defragments
files without any user intervention
42Working with Drives
- Disk caching
- Disk cache is a program that monitors drive
access - Retrieving data from RAM is much faster than
retrieving data from a hard drive - Frequently needed data is stored in RAM in the PC
in an area called a cache (sometimes it is stored
in RAM built into the hard drive called caching
controllers) - SMARTDRV.EXE is a DOS program that makes an
excellent disk cache. - RAM drives are assigned drive letters, and users
can read, write, copy, or delete to and from a
RAM drive. - Devicec\dos\ramdrive.sys 1024
43Smartdrv
- Run Smartdrv by including it in autoexec.bat
- Tweak smartdrv to work its best by checking the
hit rate - Hit rate (number of times data is in the
cache/number of times data is requested) x 100 - A good hit rate is in range of 75-90
- Use smartdrv /s to get the information needed to
calculate your hit rate
See pages 520-521 in the book for more about
smartdrv.
44The Computer Virus
- A virus is a program with two main functions -
proliferation and activation. - Boot sector, executable, macro, Trojan, Worm, and
Bimodal/Bipartite are six common types of viruses
that exist.
45The Computer Virus
- Boot sector
- Changes the code in the master boot record
- FDISK /MBR will fix if you dont have a disk
overlay program - Executable
- Resides in executable files and copies itself
into other executable files - Macro
- Auto-starts when an application is run
46The Computer Virus
- Trojan
- Sophisticated program that causes severe damage
- Worm
- Makes copies of itself on to the other systems on
a network - Bimodal/Bipartite
- Uses both boot-sector and executable functions
47Antivirus Programs
- Antivirus programs use different techniques to
combat different types of viruses. - A library of signatures (code pattern of viruses)
is used for detecting executable viruses. - Antivirus programs create a checksum on every
file in the drive to combat unknown polymorphs - A polymorph attempts to change its signature to
prevent detection - Stealth viruses use various methods to try to
hide from antivirus software
48Virus Prevention Tips
- Antivirus programs can be installed to
automatically scan floppies and downloads. - Bootable antivirus floppy disks can be used to
eliminate susceptible viruses.