SlideShare a Scribd company logo
Operating system- i
Software and Hardware –
Hardware - Hardware refers to the physical components of a computer. Computer Hardware is any
part of the computer that we can touch these parts (tangible in nature). These are the primary
electronic devices used to build up the computer. Examples of hardware in a computer are the
Processor, Memory devices, Monitor, Printer, Keyboard, Mouse, and the Central Processing Unit.
Software - Software is a collection of programming code installed on our computer's hard
drive. Software is a set of instruction that tells a computer exactly what to do. Software is a collection
of instructions, procedures, documentation that performs different tasks on a computer system. We
can say also Computer Software is a programming code executed on a computer processor. The code
can be machine-level code or the code written for an operating system. Software is intangible in
nature. Examples of software are Ms Word, Excel, Power Point, Google Chrome, Photoshop, MySQL
etc.
Basically there are two types of software Application software and System software.
Application Software - Application Software is a program that does real work for the user.
It is mostly created to perform a specific task for a user. Application Software acts as a mediator
between the end-user and System Software. It is also known as an application package. This type of
software is written using a high-level language like C, Java, VB. Net, etc. It is a user-specific and is
designed to meet the requirements of the user. We can also install multiple Application Software on a
single System Software. You can store this kind of software on CDs, DVDs, flash derive, or keychain
storage devices. Example: Word-processing, Spreadsheet, Database, etc.
System Software - System Software is the type of software which is the interface between
application software and system. Low level languages are used to write the system software. System
Software maintain the system resources and give the path for application software to run. An
important thing is that without system software, system can not run. It is a general purpose software.
System software provides an interface between the system hardware and the user. It lets
the system understand the command that the user inputs. We can also say that the system software
serves as an interface between the hardware in a system and application software. It is also called as
general purpose software. The end user usually does not directly interact with the system software.
The user only gets to interact with the GUI that has been created by the system software.
The main difference between System Software and Application Software is that without
system software, system can not run on the other hand without application software, system always
runs.
There is one another type of software i.e. called as Utility software.
Utility Software - Serve as tools for doing system maintenance and repairs not handled by operating
system
Utilities make it easier for users to:
• Copy files between storage devices
• Repair damaged data files
• Translate files so different programs can read them
• Guard against viruses and other harmful programs
• Compress files so they take up less space
An Operating System is a program that acts as an intermediary/interface
between a user and the computer.
An operating system is a software which performs all the basic tasks like file
management, memory management, process management, handling input and output, and
controlling peripheral devices such as disk drives and printers.
An operating system, or "OS," is software that communicates with the hardware and allows
other programs to run. It is comprised of system software, or the fundamental files your
computer needs to boot up and function. Every desktop computer, tablet, and smartphone
includes an operating system that provides basic functionality for the device.
Common desktop operating systems include Windows, OS X, and Linux. While each
OS is different, most provide a graphical user interface, or GUI, that includes a desktop and
the ability to manage files and folders. They also allow you to install and run programs
written for the operating system. Windows and Linux can be installed on
standard PC hardware, while OS X is designed to run on Apple systems. Therefore, the
hardware you choose affects what operating system(s) you can run.
Mobile devices, such as tablets and smartphones also include operating systems
that provide a GUI and can run applications. Common mobile OSes include Android, iOS, and
Windows Phone. These OSes are developed specifically for portable devices and therefore
are designed around touchscreen input. While early mobile operating systems lacked many
features found in desktop OSes, they now include advanced capabilities, such as the ability to
run third-party apps and run multiple apps at once. Other operating systems are VMS,
OS/400, AIX, z/OS.
Since the operating system serves as a computer's fundamental user interface, it
significantly affects how you interact with the device. Therefore, many users prefer to use
a specific operating system. For example, one user may prefer to use a computer with OS
X instead of a Windows-based PC. Another user may prefer an Android-based
smartphone instead of an iPhone, which runs the iOS.
When software developers create applications, they must write
and compile them for a specific operating system. This is because each OS communicates
with the hardware differently and has a specific application program interface, or API,
that the programmer must use. While many popular programs are crossplatform,
meaning they have been developed for multiple OSes, some are only available for a
single operating system. Therefore, when choosing a computer, make sure the operating
system supports the programs you want to run.
Operating System Structure
Where Does an Operating System Live?
A bootup program usually stores in ROM, loads the operating system from disk into
the main memory of the computer when the machine is started or reset. Once loaded, some
portions of it remain permanently in RAM while the computer is running and executing
different user jobs. It therefore, shares the memory with the jobs that are currently running.
Since an operating system is very large, other portions of the system are swapped in and out of
memory when and where required by the user.
The Operating System
When you turn on the computer, the CPU automatically begins
executing instructions stored in ROM. The operating system (OS) loads
from the disk into part of the system’s memory.
The Operating System (cont.)
The OS loads the application program into memory and remains in
memory, so it can provide services to the application program—display
on-screen menus, communicate with the printer,
and perform other common actions.
The Operating System (cont.)
NeCessityof operatingsystem
Following are the points that justify the need and importance of an operating system
 Operating system behaves as a resource manager. It utilizes the computer in a cost
effective manner. It keeps account of different jobs and the where about of their results
and locations in the memory.
 It schedules jobs according to their priority passing control from one program to the
next. The overall function of job control is especially important where there are several
users (a multi user environment).
 Operating system makes a communication link between user and the system and
helps the user to run application programs properly and get the required output.
 Operating system has the ability to fetch the programs in the memory when required
and not all the operating system to be loaded in the memory at the same time. Thus
giving the user the space to work in the required package more conveniently and easily.
 Operating system helps the user in file management, making of directions, and
saving files in them, is a very good feature provided by the operating system to organize
data according to the needs of the user.
 Multiprogramming is a very important feature of operating system. It schedules and
controls the running of several programs at once.
 It provides program editors that help the user to modify and update the program
lines.
 Debugging aids provided by the operating system help the user to detect and
rename errors in programs
 Disk maintenance ability of operating system checks the validity of data stored on
diskettes and perhaps make corrections to erroneous data.
Other Important Activities of Operating System
Security − By means of password and similar other techniques, it prevents unauthorized
access to programs and data.
Control over system performance − Recording delays between request for a service and
response from the system.
Job accounting − Keeping track of time and resources used by various jobs and users.
Error detecting aids − Production of dumps, traces, error messages, and other debugging
and error detecting aids.
Coordination between other softwares and users − Coordination and assignment of
compilers, interpreters, assemblers and other software to the various users of the computer
systems.
Basically, an Operating System has three main responsibilities:
(a) Perform basic tasks such as recognizing input from the keyboard, sending
output to the display screen, keeping track of files and directories on the disk,
and controlling peripheral devices such as disk drives and printers.
(b) Ensure that different programs and users running at the same time do not
interfere with each other.
(c) Provide a software platform on top of which other programs can run.
Functionsof operatingsystem
The main functions perform by most Operating System of today are as follow: -
1. Process Management: - The process management module of an Operating
System takes care of the creation & deletion of processes, scheduling of various system
resources to the different process requesting them, & providing mechanism for
synchronization & communication among processes.
2. Memory Management: - The memory management module of an Operating
System takes care of the allocation & reallocation of memory space to the various
program in need of this resource.
3. File Management: - computer use a lot of data & programs, which are,
stored on secondary storage devices. File management functions of an Operating System.
Involves keeping track of all different files & maintaining the integrity of data stored in
the files including file directory structure.
4. Security: - The security modules of an Operating System protect the
resources & information of a computer system against destruction& unauthorized access.
5. Command Interpretation: -The Command Interpretation module of an
Operating System takes care of interpreting of user commands, & directing the system
resources to handle the requests. With this mode of interaction with the system, the user
is usually not too concerned with the hardware details of the system.
6. Input/Output or Device Management: - coordination & control of
various input & output devices is an important function of the Operating System.
This involves receiving the request for I/O interrupts, & communicating back to the
requesting process.
7. Job Control: - When the user wants to run an application program, he
must communicate with the Operating System telling it what to do. He does this
using Operating System job control language or JCL. JCL consists of a number of
Operating Systems commands, called system commands that control the
functioning of the Operating System.
Memory management
Memory management is the functionality of an operating system which
handles or manages primary memory and moves processes back and forth
between main memory and disk during execution. Memory management keeps
track of each and every memory location, regardless of either it is allocated to
some process or it is free. It checks how much memory is to be allocated to
processes. It decides which process will get memory at what time. It tracks
whenever some memory gets freed or unallocated and correspondingly it
updates the status.
Main Memory refers to a physical memory that is the internal memory
to the computer. The word main is used to distinguish it from external mass
storage devices such as disk drives. Main memory is also known as RAM. The
computer is able to change only data that is in main memory. Therefore, every
program we execute and every file we access must be copied from a storage
device into main memory.
All the programs are loaded in the main memeory for execution.
Sometimes complete program is loaded into the memory, but some times a
certain part or routine of the program is loaded into the main memory only
when it is called by the program, this mechanism is called Dynamic Loading,
this enhance the performance.
Also, at times one program is dependent on some other program. In
such a case, rather than loading all the dependent programs, CPU links the
dependent programs to the main executing program when its required. This
mechanism is known as Dynamic Linking.
• It allows you to check how much memory needs to be allocated to processes
that decide which process should get memory at what time.
• Tracks whenever inventory gets freed or unallocated. According to it will update
the status.
• It allocates the space to application routines.
• It also make sure that these applications do not interfere with each other.
• Helps protect different processes from each other
• It places the programs in memory so that memory is utilized to its full extent.
Swapping
A process needs to be in memory for execution. But sometimes there is not enough
main memory to hold all the currently active processes in a timesharing system. So, excess
process are kept on disk and brought in to run dynamically. Swapping is the process of
bringing in each process in main memory, running it for a while and then putting it back to the
disk.
Contiguous Memory Allocation
In contiguous memory allocation each process is contained in a single contiguous
block of memory. Memory is divided into several fixed size partitions. Each partition contains
exactly one process. When a partition is free, a process is selected from the input queue and
loaded into it.
Memory Allocation
Memory allocation is a process by which computer programs are assigned
memory or space. It is of three types :
First Fit: The first hole that is big enough is allocated to program.
Best Fit: The smallest hole that is big enough is allocated to program.
Worst Fit: The largest hole that is big enough is allocated to program.
Fragmentation
Fragmentation occurs in a dynamic memory allocation system when most
of the free blocks are too small to satisfy any request. It is generally termed as
inability to use the available memory.
In such situation processes are loaded and removed from the memory. As a
result of this, free holes exists to satisfy a request but is non contiguous i.e. the
memory is fragmented into large no. Of small holes. This phenomenon is known
as External Fragmentation.
Also, at times the physical memory is broken into fixed size blocks and
memory is allocated in unit of block sizes. The memory allocated to a space may
be slightly larger than the requested memory. The difference between allocated
and required memory is known as Internal fragmentation i.e. the memory that is
internal to a partition but is of no use.
Paging
A solution to fragmentation problem is Paging. Paging is a memory
management mechanism that allows the physical address space of a process to be
non-contagious. Here physical memory is divided into blocks of equal size
called Pages. The pages belonging to a certain process are loaded into available
memory frames.
Segmentation
Segmentation is another memory management scheme that supports the
user-view of memory. Segmentation allows breaking of the virtual address space of
a single process into segments that may be placed in non-contiguous areas of
physical memory.
Memory Protection
Memory protection is a phenomenon by which we control memory access
rights on a computer. The main aim of it is to prevent a process from accessing
memory that has not been allocated to it. Hence prevents a bug within a process
from affecting other processes
Types of Computer Memories:
Memory is the best essential element of a computer because computer can’t
perform simple tasks. The performance of computer mainly based on memory and
CPU. Memory is internal storage media of computer that has several names such as
majorly categorized into two types, Main memory and Secondary memory.
1. Primary Memory / Volatile Memory.
2. Secondary Memory / Non Volatile Memory.
1. Primary Memory / Volatile Memory:
Primary Memory also called as volatile memory because the memory can’t
store the data permanently. It also has another name i.e. RAM.
Random Access Memory (RAM):
The primary storage is referred to as random access memory (RAM) due to
the random selection of memory locations. It performs both read and write
operations on memory. If power failures happened in systems during memory
access then you will lose your data permanently. So, RAM is volatile memory.
RAM is of two types −
Static RAM (SRAM)
Dynamic RAM (DRAM)
Static RAM (SRAM)
The word static indicates that the memory retains its contents as long as
power is being supplied.
Dynamic RAM (DRAM)
DRAM, unlike SRAM, must be continually refreshed in order to maintain
the data. DRAM is used for most system memory as it is cheap and small.
Secondary Memory / Non Volatile Memory:
Secondary memory is external and permanent memory that is useful to
store the external storage media such as floppy disk, magnetic disks, magnetic
tapes and etc cache devices. Secondary memory deals with following types of
components.
Read Only Memory (ROM) :
ROM is permanent memory location that offer huge types of standards to
save data. But it work with read only operation. No data lose happen whenever
power failure occur during the ROM memory work in computers.
The various types of ROMs are:
MROM (Masked ROM)
The very first ROMs were hard-wired devices that contained a pre-
programmed set of data or instructions. These kind of ROMs are known as masked
ROMs, which are inexpensive.
PROM (Programmable Read Only Memory)
PROM is read-only memory that can be modified only once by a user. The
user buys a blank PROM and enters the desired contents using a PROM program.
EPROM (Erasable and Programmable Read Only Memory)
EPROM can be erased by exposing it to ultra-violet light for a duration of
up to 40 minutes. Usually, an EPROM eraser achieves this function.
EEPROM (Electrically Erasable and Programmable Read Only Memory)
EEPROM is programmed and erased electrically. It can be erased and
reprogrammed about ten thousand times.
Cache Memory
Cache memory is a very high speed semiconductor memory which can
speed up the CPU. It acts as a buffer between the CPU and the main memory. It is
used to hold those parts of data and program which are most frequently used by
the CPU. The parts of data and programs are transferred from the disk to cache
memory by the operating system, from where the CPU can access them.
Device Management
An OS manages device communication via their respective drivers. It
performs the following activities for device management. Keeps tracks of all
devices connected to system. designates a program responsible for every device
known as the Input/Output controller. Decides which process gets access to a
certain device and for how long. Allocates devices in an effective and efficient way.
Deallocates devices when they are no longer required.
User Level
Operating System Level
Hardware Level
An OS manages device communication via their respective drivers. It
performs the following activities for device management. Keeps tracks of all
devices connected to system. designates a program responsible for every device
known as the Input/Output controller. Decides which process gets access to a
certain device and for how long. Allocates devices in an effective and efficient way.
Deallocates devices when they are no longer required.
User applications
Various OS components
Device drivers
Device controllers
I/O devices
One of the important jobs of an Operating System is to manage
various I/O devices including mouse, keyboards, touch pad, disk drives, display adapters,
USB devices, Bit-mapped screen, LED, Analog-to-digital converter, On/off switch, network
connections, audio I/O, printers etc.
User interact with machines by providing information through IO devices.
Clearly, management of all these devices can affect the throughput of a system.
For this reason, input output management also becomes one of the primary responsibilities
of an operating system.
An I/O system is required to take an application I/O request and send it to the
physical device, then take whatever response comes back from the device and send it to the
application. I/O devices can be divided into two categories −
Block devices − A block device is one with which the driver communicates by sending
entire blocks of data. For example, Hard disks, USB cameras etc.
Character devices − A character device is one with which the driver communicates by
sending and receiving single characters (bytes, octets). For example, serial ports, parallel
ports, sounds cards etc.
Network device - For transmitting data packets.
When we analyze device communication, we notice that communication is
required at the following three levels: -
The need for a human to input information and receive output from a computer.
The need for a device to input information and receive output from a computer.
The need for computers to communicate (receive/send information) over networks.
An operating system or the OS manages communication with the devices
through their respective drivers. The operating system component provides a
uniform interface to access devices of varied physical attributes. For device
management in operating system:
Keep tracks of all devices and the program which is responsible to
perform this is called I/O controller.
Monitoring the status of each device such as storage drivers, printers and
other peripheral devices.
Enforcing preset policies and taking a decision which process gets the
device when and for how long.
Allocates and Deallocates the device in an efficient way. De-allocating
them at two levels: at the process level when I/O command has been executed
and the device is temporarily released, and at the job level, when the job is
finished and the device is permanently released.
Optimizes the performance of individual devices.
Device Management Functions
The management of I/O devices such as printers, card readers, taps, disk
and supporting devices such as control unit and control channel.
The basic function of I/O devices are:
1. Track status of all devices which are requires special mechanism.
2. Deciding the policy on determine which process gets a device, for how
long and where.
There are three basic techniques for implementing a device for policy.
1. Dedicated : A technique where a device is assign to a single process.
2. Shared : A technique where a device shared by many processes.
3. Virtual : A technique where one physical device this simulated on another
physical device. Its Combination of dedicated devices that have been transformed
into shared devices.
3. Allocation : Physically ascending a device to process with controlling unit and
channel.
4. De-allocation : De-allocate the devices at 2 levels.
1. On job level : A device assign only for as long as the job exits in the system.
2. On process level : A device assign only for as long as the process needs it.
Device characteristics
Devices can be categorizes into two groups.
1. Input/Output Device.
2. Storage devices.
1. Input/Output Devices :
An input devices takes data from the outside world.
An output device which produce data to the outside world.
Example : Card reader (Input device)
Printer (output Device)
2. Storage Device :
It is a mechanism by which the computer may store the information in
such a way that information may be retrieve at later time.
There are following three types of storage devices.
1. Serial Access Devices.
2. Completely Direct Access.
3. Direct Access Storage device (DASD).
1. Serial Access Devices : It can be characterized as one that dependence on
physical sequential positioning and accessing information.
Example, Magnetic tap unit where information is stored as a group of byte called records
of any length.
Each record can be identify by it physical position on the tap
Example, the first record is one second record is second and So on.
2. Completely direct access devices :
A completely direct access devices is one in which the access time is
constant.
It requires less time and less cost.
Example, Magnetic code memory,
semiconductor memory
3.Direct Access storage device (DASD) :
A direct access device is one that is characterized by small variances in the
access time. These have been called direct access storage devices.
Example :Magnetic drum and disk.
Summary –
An Operating System will have device drivers to facilitate I/O functions involving
I/O devices. These device drivers are software routines that control respective I/O
devices through their controllers.
The Operating System is responsible for the following I/O Device Management
Functions:
Keep track of the I/O devices, I/O channels, etc. This module is typically
called I/O traffic controller.
Decide what is an efficient way to allocate the I/O resource. If it is to be
shared, then decide who gets it, how much of it is to be allocated, and for how
long. This is called I/O scheduling.
Allocate the I/O device and initiate the I/O operation.
Reclaim device as and when its use is through. In most cases I/O
terminates automatically.
Job scheduling
Job scheduling is the process of allocating system resources to many
different tasks by an operating system (OS). The system handles prioritized job
queues that are awaiting CPU time and it should determine which job to be
taken from which queue and the amount of time to be allocated for the job.
This type of scheduling makes sure that all jobs are carried out fairly and on
time.
Most OSs like Unix, Windows, etc., include standard job-scheduling
abilities. A number of programs including database management systems
(DBMS), backup, enterprise resource planning (ERP) and business process
management (BPM) feature specific job-scheduling capabilities as well.
Job scheduling is performed using job schedulers. Job schedulers are
programs that enable scheduling and, at times, track computer "batch" jobs, or
units of work like the operation of a payroll program. Job schedulers have the
ability to start and control jobs automatically by running prepared job-control-
language statements or by means of similar communication with a human
operator. Generally, the present-day job schedulers include a graphical user
interface (GUI) along with a single point of control.
Process scheduling is an essential part of a Multiprogramming operating systems.
Such operating systems allow more than one process to be loaded into the executable
memory at a time and the loaded process shares the CPU using time multiplexing.
Process Scheduling Queues
The OS maintains all Process Scheduling Queues. The OS maintains a separate queue for
each of the process states and all processes in the same execution state are placed in the
same queue. When the state of a process is changed, it is unlinked from its current queue
and moved to its new state queue.
The Operating System maintains the following important process scheduling
queues −
Job queue − This queue keeps all the processes in the system.
Ready queue − This queue keeps a set of all processes residing in main memory,
ready and waiting to execute. A new process is always put in this queue.
Device queues − The processes which are blocked due to unavailability of an I/O
device constitute this queue.
Different job scheduling in operating systems.
Job scheduling schedules or decides which process will get to acquire the resource
based on some parameters.
The OS can use different policies to manage each queue
- FIFO- The process that comes first is executed first.
- Shortest job First- The time taken to complete the job of all processes is
computed and the shortest length process is executed first.
- Round Robin- Each process gets a time “share” for running and is later prevented
to get the next process running. This process is known as time sharing, which
provides the effect of all the processes running at the same time.
- Priority scheduling- Here, the process on highest priority gets the resource.
Schedulers
Schedulers are special system software which handle process scheduling in
various ways. Their main task is to select the jobs to be submitted into the system
and to decide which process to run. Schedulers are of three types −
Long-Term Scheduler
Short-Term Scheduler
Medium-Term Scheduler
Long Term Scheduler
It is also called a job scheduler. A long-term scheduler determines which
programs are admitted to the system for processing. It selects processes from the
queue and loads them into memory for execution. Process loads into the memory for
CPU scheduling.
The primary objective of the job scheduler is to provide a balanced mix of
jobs, such as I/O bound and processor bound. It also controls the degree of
multiprogramming. If the degree of multiprogramming is stable, then the average
rate of process creation must be equal to the average departure rate of processes
leaving the system.
On some systems, the long-term scheduler may not be available or minimal.
Time-sharing operating systems have no long term scheduler. When a process
changes the state from new to ready, then there is use of long-term scheduler.
Short Term Scheduler
It is also called as CPU scheduler. Its main objective is to increase system
performance in accordance with the chosen set of criteria. It is the change of ready
state to running state of the process. CPU scheduler selects a process among the
processes that are ready to execute and allocates CPU to one of them.
Short-term schedulers, also known as dispatchers, make the decision of
which process to execute next. Short-term schedulers are faster than long-term
schedulers.
Medium Term Scheduler
Medium-term scheduling is a part of swapping. It removes the processes
from the memory. It reduces the degree of multiprogramming. The medium-term
scheduler is in-charge of handling the swapped out-processes.
A running process may become suspended if it makes an I/O request. A
suspended processes cannot make any progress towards completion. In this
condition, to remove the process from memory and make space for other processes,
the suspended process is moved to the secondary storage. This process is called
swapping, and the process is said to be swapped out or rolled out. Swapping may be
necessary to improve the process mix.
I/o management
One of the important jobs of an Operating System is to manage
various I/O devices including mouse, keyboards, touch pad, disk drives, display
adapters, USB devices, Bit-mapped screen, LED, Analog-to-digital converter, On/off
switch, network connections, audio I/O, printers etc.
Humans interact with machines by providing information through IO
devices.
Clearly, management of all these devices can affect the throughput of a
system. For this reason, input output management also becomes one of the primary
responsibilities of an operating system.
An I/O system is required to take an application I/O request and send it to
the physical device, then take whatever response comes back from the device and
send it to the application. I/O devices can be divided into two categories −
Block devices − A block device is one with which the driver communicates by
sending entire blocks of data. For example, Hard disks, USB cameras etc.
Character devices − A character device is one with which the driver communicates
by sending and receiving single characters (bytes, octets). For example, serial ports,
parallel ports, sounds cards etc
Issues in IO Management
When we analyze device communication, we notice that communication is
required at the following three levels:
The need for a human to input information and receive output from a
computer.
The need for a device to input information and receive output from a
computer.
The need for computers to communicate (receive/send information) over
networks.
To meet these varied requirements, The basic idea is to select a mode of
communication taking device characteristics into account or a need to
synchronize with some event. Computers employ the following four basic modes
of IO operation:
1. Programmed mode
2. Polling mode
3. Interrupt mode
4. Direct memory access mode.
Programmed Data Mode - In this mode of communication, execution of an IO
instruction ensures that a program shall not advance till it is completed.
POLLING -In this mode of data transfer, the system interrogates each device in
turn to determine if it is ready to communicate. If it is ready, communication is
initiated and subsequently the process continues again to interrogate in the same
sequence.
Interrupt Mode - Let us begin with a simple illustration to explain the basic
interrupt mode of data transfer. Suppose a program needs input from a device
which communicates using interrupt. Even with the present-day technology the
devices are one thousand or more times slower than the processor
So if the program waits on the input device it would waste many
processor cycles just waiting for the input device to be ready to communicate.
This is where the interrupt mode starts
At the time when the device is actually ready to establish an IO, the
device raises an interrupt to seek communication. Immediately the program
execution is suspended temporarily and current state of the process is stored. The
control is passed on to an interrupt service routine (which may be specific to the
device) to perform the desired input
Direct memory access (DMA) is a feature of computer systems that allows certain
hardware subsystems to access main system memory (Random-access memory),
independent of the central processing unit(CPU).
Without DMA, when the CPU is using programmed input/output, it is
typically fully occupied for the entire duration of the read or write operation, and
is thus unavailable to perform other work.
DMA(Direct memory access) Mode of Data Transfer This is a mode of
data transfer in which IO is performed in large data blocks. For instance, the disks
communicate in data blocks of sizes like 512 bytes or 1024 bytes. The direct
memory access, or DMA ensures access to main memory without processor
intervention or support. Such independence from processor makes this mode of
transfer extremely efficient.
Resource management
The various roles of an operating system generally revolve around the idea
of "sharing nicely." An operating system manages resources, and these resources
are often shared in one way or another among the various programs that want to
use them. multiple programs executing concurrently share the use of main
memory; they take turns using the CPU; and they compete for an opportunity to
use input and output devices.
There are various aspects or resources that require management in a
computer system, including: primary memory and secondary memory, processor,
bandwidth, graphics and sound, networks, and cache.
A computer system has many resources, which are to be required to solve
a computing problem. These resources are the CPU time, memory space, files
storage space, input/output devices and so on. The Operating System acts as a
manager of all of these resources and allocates them to the specific programs and
users as needed by their tasks. Since there can be many conflicting requests for the
resources, the Operating System must decide which requests are to be allocated
resources to operate the computer system fairly and efficiently.
The Operating System is a manager of system resources. A computer
system has many resources as stated above. Since there can be many conflicting
requests for the resources, the Operating System must decide which requests are
to be allocated resources to operate the computer system fairly and efficiently.
Here we present a framework of the study of Operating System based on the
view that the Operating System is manager of resources.
The Operating System as a resources manager can be classified in to the
following three popular views: primary view, hierarchical view, and extended
machine view.
The primary view is that the Operating System is a collection of programs
designed to manage the system’s resources, namely, memory, processors,
peripheral devices, and information. It is the function of Operating System to see
that they are used efficiently and to resolve conflicts arising from competition
among the various users. The Operating System must keep track of status of each
resource; decide which process is to get the resource, allocate it, and eventually
reclaim it.
Summary of Resource Management –
Manages and protects multiple computer resources: CPU, Processes,
Internal/External memory, Tasks, Applications, Users, Communication channels,
etc…
Handles and allocates resources to multiple users or multiple programs
running at the same time and space (e.g., processor time, memory, I/O devices).
Decides between conflicting requests for efficient and fair resource use
(e.g., maximize throughput, minimize response time).
Types of Operating systems
Following are the popular types of Operating System:
Batch Processing OS
Multiprocessing OS
Time Sharing OS
Real Time OS
Distributed OS
Network OS
Batch Processing OS
In the era of 1970s, the Batch processing was very popular. The Jobs were
executed in batches. People were used to have a single computer which was called
mainframe.
The system put all of the jobs in a queue on the basis of first come first
serve and then executes the jobs one by one. The users collect their respective
output when all the jobs get executed.
In Batch operating system, access is given to more than one person; they
submit their respective jobs to the system for the execution.
The user of a batch operating system never directly interacts with the
computer. In this type of OS, every user prepares his or her job on an offline
device like a punch card and submit it to the computer operator.
The programmers leave their programs with the operator and the
operator then sorts the programs with similar requirements into batches.
The problems with Batch Systems are as follows −
1) Lack of interaction between the user and the job.
2) CPU is often idle, because the speed of the mechanical I/O devices is slower
than the CPU.
3) Difficult to provide the desired priority.
4) Starvation - Batch processing suffers from starvation. If there are five jobs J1,
J2, J3, J4 and J5 present in the batch. If the execution time of J1 is very high then
other four jobs will never be going to get executed or they will have to wait for a
very high time. Hence the other processes get starved.
5) Not Interactive - Batch Processing is not suitable for the jobs which are
dependent on the user's input. If a job requires the input of two numbers from
the console then it will never be going to get it in the batch processing scenario
since the user is not present at the time of execution.
Multiprogramming Operating System –
Multiprogramming is an extension to the batch processing where the CPU is
kept always busy. Each process needs two types of system time: CPU time and IO
time.
In multiprogramming environment, for the time a process does its I/O, The
CPU can start the execution of other processes. Therefore, multiprogramming
improves the efficiency of the system.
In this the operating system picks up and begins to execute one of the jobs
from memory.
Once this job needs an I/O operation operating system switches to another
job (CPU and OS always busy).
Jobs in the memory are always less than the number of jobs on disk(Job
Pool).
If several jobs are ready to run at the same time, then the system chooses
which one to run through the process of CPU Scheduling.
In Non-multiprogrammed system, there are moments when CPU sits idle and
does not do any work.
In Multiprogramming system, CPU will never be idle and keeps on processing.
Time-sharing operating systems -
Time Sharing Systems are very similar to Multiprogramming systems. In
fact time sharing systems are an extension of multiprogramming systems.
In Time sharing systems the prime focus is on minimizing the response
time, while in multiprogramming the prime focus is to maximize the CPU usage.
Time-sharing is a technique which enables many people, located at
various terminals, to use a particular computer system at the same time. Time-
sharing or multitasking is a logical extension of multiprogramming. Processor's
time which is shared among multiple users simultaneously is termed as time-
sharing.
The main difference between Multiprogramming Systems and Time-
Sharing Systems is that in case of Multiprogramming systems, the objective is to
maximize processor use, whereas in Time-Sharing Systems, the objective is to
minimize response time.
Multiple jobs are executed by the CPU by switching between them, but
the switches occur so frequently. Thus, the user can receive an immediate
response. For example, in a transaction processing, the processor executes each
user program in a short burst or quantum of computation. That is, if n users are
present, then each user can get a time quantum. When the user submits the
command, the response time is in few seconds at most.
The operating system uses CPU scheduling and multiprogramming to
provide each user with a small portion of a time. Computer systems that were
designed primarily as batch systems have been modified to time-sharing systems.
Advantages of Timesharing operating systems are as follows −
1)Provides the advantage of quick response.
2)Avoids duplication of software.
3)Reduces CPU idle time.
Disadvantages of Time-sharing operating systems are as follows −
1) Problem of reliability.
2) Question of security and integrity of user programs and data.
3) Problem of data communication.
Real Time Operating System –
In Real Time systems, each job carries a certain deadline within which the
Job is supposed to be completed, otherwise the huge loss will be there or even if
the result is produced then it will be completely useless.
The Application of a Real Time system exists in the case of military
applications, if you want to drop a missile then the missile is supposed to be
dropped with certain precision.
A real time operating system time interval to process and respond to
inputs is very small. Examples: Military Software Systems, Space Software Systems
are the Real time OS example.
A real-time system is defined as a data processing system in which the
time interval required to process and respond to inputs is so small that it controls
the environment. The time taken by the system to respond to an input and
display of required updated information is termed as the response time. So in this
method, the response time is very less as compared to online processing.
Real-time systems are used when there are rigid time requirements on
the operation of a processor or the flow of data and real-time systems can be
used as a control device in a dedicated application. A real-time operating system
must have well-defined, fixed time constraints, otherwise the system will fail. For
example, Scientific experiments, medical imaging systems, industrial control
systems, weapon systems, robots, air traffic control systems, etc.
There are two types of real-time operating systems.
Hard real-time systems
Hard real-time systems guarantee that critical tasks complete on time. In
hard real-time systems, secondary storage is limited or missing and the data is
stored in ROM. In these systems, virtual memory is almost never found.
Soft real-time systems
Soft real-time systems are less restrictive. A critical real-time task gets
priority over other tasks and retains the priority until it completes. Soft real-time
systems have limited utility than hard real-time systems. For example, multimedia,
virtual reality, Advanced Scientific Projects like undersea exploration and
planetary rovers, etc.
Distributed Operating System –
Distributed systems use many processors located in different machines to
provide very fast computation to its users.
Distributed systems use multiple central processors to serve multiple
real-time applications and multiple users. Data processing jobs are distributed
among the processors accordingly.
The processors communicate with one another through various
communication lines (such as high-speed buses or telephone lines). These are
referred as loosely coupled systems or distributed systems. Processors in a
distributed system may vary in size and function. These processors are referred as
sites, nodes, computers, and so on.
The advantages of distributed systems are as follows −
1) With resource sharing facility, a user at one site may be able to use the
resources available at another.
2) Speedup the exchange of data with one another via electronic mail.
3) If one site fails in a distributed system, the remaining sites can
potentially continue operating.
4) Better service to the customers.
5) Reduction of the load on the host computer.
6) Reduction of delays in data processing.
The motivation behind developing distributed operating systems is the
availability of powerful and inexpensive microprocessors and advances in
communication technology.
These advancements in technology have made it possible to design and
develop distributed systems comprising of many computers that are inter
connected by communication networks. The main benefit of distributed systems
is its low price/performance ratio.
Types of Distributed Operating Systems
Following are the two types of distributed operating systems used:
Client-Server Systems
Peer-to-Peer Systems
Network Operating Systems –
A Network Operating System runs on a server and provides the server the
capability to manage data, users, groups, security, applications, and other networking
functions. The primary purpose of the network operating system is to allow shared file
and printer access among multiple computers in a network, typically a local area
network (LAN), a private network or to other networks.
Examples of network operating systems include Microsoft Windows Server
2003, Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and
BSD.
The advantages of network operating systems are as follows −
Centralized servers are highly stable.
Security is server managed.
Upgrades to new technologies and hardware can be easily integrated into the
system.
Remote access to servers is possible from different locations and types of
systems.
The disadvantages of network operating systems are as follows −
High cost of buying and running a server.
Dependency on a central location for most operations.
Regular maintenance and updates are required.
Disk operating sytem (dos)
DOS Stands for "Disk Operating System." DOS was the first operating
system used by IBM-compatible computers. It was originally available in two
versions that were essentially the same, but marketed under two different names.
"PC-DOS" was the version developed by IBM and sold to the first IBM-compatible
manufacturers. "MS-DOS" was the version that Microsoft bought the rights to, and
was bundled with the first versions of Windows.
DOS uses a command line, or text-based interface, that allows the user to
type commands. By typing simple instructions such as pwd (print working directory)
and cd (change directory), the user can browse the files on the hard drive, open files,
and run programs. While the commands are simple to type, the user must know the
basic commands in order to use DOS effectively (similar to Unix). This made the
operating system difficult for novices to use, which is why Microsoft later bundled
the graphic-based Windows operating system with DOS.
The first versions of Windows (through Windows 95) actually ran on top of
the DOS operating system. This is why so many DOS-related files (such as .INI, .DLL,
and .COM files) are still used by Windows. However, the Windows operating system
was rewritten for Windows NT (New Technology), which enabled Windows to run on
its own, without using DOS. Later versions of Windows, such as Windows 2000, XP,
and Vista, also do not require DOS.
DOS is still included with Windows, but is run from the Windows
operating system instead of the other way around. The DOS command prompt
can be opened in Windows by selecting "Run..." from the Start Menu and typing
cmd.
DOS uses the File Allocation Table (FAT) filesystem. The purpose of
the file allocation table is to keep track of where to find files on the disk.
When someone say that their disk is NTFS or FAT, it actually refers to the file
system that’s being used by the computer or more appropriately, the operating
system.
In MS-DOS, every DOS based partition has a letter: (A: or B: or C:).
Typically, the drive letters A: and B: are reserved for floppy drives. You will most
frequently find that the C: drive is the 'bootable partition'. Each drive has a root
directory ('') so the root directory on a given drive looks like this: C:
Changing drives is as simple as typing the name of the drive letter:
A:> C: <enter> ↵
C:>
MS-DOS then stores files to the system in any arrangement you choose.
You can create directories, and store files within those directories. A typical
file/path might look like this:
C:ms-dosmydirR8.txt
LIMITATIONS
FAT16 filesystems are compatible with all Microsoft operating systems, but
it has severe limitations. First, all files on the system are limited to eight characters
and a three letter extension. The MS-DOS filesystem also has a limit of
approximately 2.1 Gigabytes owing to the fact that the MS-DOS operating system
doesn't recognize 'Int 13' based commands, and therefore cannot issue commands
to access the remainder of larger disks.
Keep in mind that MS-DOS is a legacy system kept around for doing
command line based work in Windows.
http://crdd.osdd.net/raghava/slides/prephd/doslec.htm
https://www.includehelp.com/disk-operating-system-dos-commands.aspx
https://ecomputernotes.com/fundamental/disk-operating-system/describe-
the-commands-in-dos-name-the-commands-with-their-syntax
http://www.ybet.be/en-operating/en-dos-2.php
https://kb.iu.edu/d/aerh
http://www.easydos.com/path.html
http://www.easydos.com/dosindex.html
https://www.tech-wonders.com/2011/06/most-commonly-used-
internal-and.html
http://www.rcppmail.org/DOS/internal_commands.htm#REn
What is BOOTing ?
When the computer is switched on, the firmware program in Read Only
Memory(ROM) also called Basic Input-Output System(BIOS) reads programs and
data i.e. Operating System and loads it into memory (RAM). This process is known
Bootstrapping(Booting). The OS once loaded takes control of the computer,
handles user interaction and executes application programs.
Booting Sequence
During Booting process, computer loads the operating system into its
memory. DOS booting involves reading following files into memory namely
IO.SYS, MSDOS.SYS, and COMMAND COM. The Basic Input/Output Program
(IO.SYS): This program provides interface between the hardware devices and
software of the system. It takes care of the keyboard input, character output to
monitor, output to printer and time of the day. The File and Disk Manager
Program (MSDOS.SYS) : It contains the file management and the disk buffering
management capabilities. It keeps track of all the disk access of an application
program and remains permanently in memory. The Command Processor
(COMMAND.COM) : It is also called command interpreter. It is the program that
displays the system prompt and handles user interface by executing the
command typed in by the user using keyboard.
Operating system as a User Interface:-
There are mainly two types of O.S. as a user interface, these are following:
· Graphical User Interface (GUI)
· Command Line Interface (CLI)
Graphical User Interface:- The GUI allows the user to select the desired option
with the help of graphical images. This type of interface uses both images and
menu to select commands ar initiate different operations. Generally these
graphical images are called Icons, which are small pictorial figures representing
different tasks, Procedures and programs.
Command User Interface:- CUI can help the user to interact or communicate
with the computer through different commands. In this type of Interface the user
has to memorize so many commands or to refer book for different commands. It
also takes time to type each commands.
DOS supports the CLI (CLI stands for: Command Line Interface /
Command Line Interpreter / Command Line Input).
Today, every OS comes with graphical user interfaces (GUI), so most users
are not aware about command-line interfaces (CLI).
The user can store data or programs on secondary storage devices called
Hard disk or Floppy disk. Physically disks store data by recording any pattern of
magnetic changes on using a tiny read-write head that moves over the surface.
Disk is divided into sectors and tracks.
The first two characters of alphabet (a: or b:) are reserved for Floppy
disks, Hard disks are identified by characters (c:) or (d:), the next character in the
sequence is assigned to Compact Disk (CD-ROM) drive further the network drives
connected to the system are assigned the remaining characters.
The "default drive" is where DOS expects to find programs and data. DOS
commands are preceded by a default drive designation (typically c:>).
(As generally by default operating system is get installed on C dirve.)
C:> is also called as system prompt. C drive is called as a default drive.
A file is a set of information grouped under single name. File can be a
address list, a set of receipes from kitchens or even an executable program. On
DOS, a file that is stored on the disk hard (or a floppy disk) is designated by a
name consisting of 1 to 8 digital - alphanumeric characters or special characters: $
& # @ ! % () - < > _ DOS uses the File Allocation Table (FAT) filesystem.
The file name is followed by an extension of 3-character maximum.
DOS does not distinguish between uppercase and lowercase letters.
The organization of the data on the hard drive (to a lesser extent the
floppy) is done by directories and subdirectories. These directories can gather the
data in specific boxes(Called as Folders) When user read data on a hard disk, user
start by the ROOT, this is the top directory of the disk. It contains data and
directories.
Some extensions of DOS file.
Text file .txt
Command file .com
System file .sys
Programme file .prg
Database file .dbm
Library file .lib
Batch file .bat
Executable file .exe
Types of DOS commands Any instruction given to the computer to
perform a specific task is called command. The DOS has several commands, each
for a particular task and these are stored in DOS directory on the disk. The
commands are of two types :
(a)Internal Commands : These are in built commands of MS-DOS i.e. these are
stored in Command interpreter file (COMMAND.COM). These commands reside
in the memory as long as the machine is at the system prompt(C:>) level. To use
these commands no extra /external file is required. E.g. DATE, TIME, DIR, VER etc.
(b) External commands : These are separate program (.com) files that reside in
DOS directory and when executed behave like commands. An external command
has predefined syntax. for e.g. HELP, DOSKEY, BACKUP, RESTORE, FORMAT etc.
There are also Batch commands or Batch files which are text files that
contain a list of internal and/or external commands which are executed in
sequence when the batch file is executed. AUTOEXEC.BAT gets executed
automatically on booting.
In MS-DOS, keyboard shortcuts involving handy ones like Functional keys, arrows, pipe
character (” | “), asterisk (*), ?, [] and ESC are of great help for recalling to searching to clearing command
line etc., Here are few of them:
UP (↑) and DOWN (↓) arrows recall previously entered commands.
ESC clears the present command line. It abandons the currently construct command and the next
prompt appears.
F1 or → retypes one character at a time from the last command entry from the current cursor position.
F2 retypes all characters from the last command entry up to the one identical to your next keystroke. It
asks you to enter char to copy up to and retypes the last command up to that char.
F3 retypes all remaining characters from the last command entry.
F4 stores all characters beginning at the first match with your next keystroke and ending with the last
command entry.
F5 or F8 keys give all the previously typed commands.
F6 places a special end-of-file code at the end of the currently open file. Sometimes referred to as Ctrl+z
or ^z.
F7 key displays command history and ALT+F7/ESC hides it.
F9 is used to select a command by number. Just enter the command number and it fetches the
command line for you.
Pipe character (” | “) combines several series of commands or programs inter-dependent.
Name enclosed within [] indicate a sub-directory.
Asterisk (*) is used to represent zero or more any characters.
? is used to present zero or single character.
DIR Command (Internal)
Purpose
DIR command is used to displays a list of files and subdirectories in a directory.
Syntax
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L]...
Example --
1) C:> DIR D:
(display all directories and files of d: drive).
2) Using "A" attribute:-
C:> DIR/AD D:
(display direcotries (folders) only of d: drive).
C:> DIR/A-D D:
(display only files of d: drive).
C:> DIR/AH D:
(display all hidden items of d: drive).
3) C:> DIR/A-D/AR D:
(display all files(only) with read only property).
Using wild characters:
1) To find all .txt (text) file from d:folder1
C:>DIR D:folder1*.txt ↵
2) To display all .docx (ms word files) starting with "A" filename.
C:>DIR D:folder1A*.docx ↵
3) To display all files of D: drive starting with "A" but third charcter of file name
must be "C" (of any type/extension).
C:>DIR D:A?C*.* ↵
4) To display all files with all extenstions of E:.
C:>DIR E:*.* ↵
Switches
/A Attribute wise filtering ..
R : Read only files.
D : Directories only.
H : Hidden items only.
S : System files only.
-D: Files only
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the default.
Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.)
S: Size wise sorting.
N: Name wise.
D: Date wise.
E: Extension wise sorting.
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Control what time field displayed or used for sorting timefield
C Creation,
A Last Access,
W Last Written
/W Uses wide list format.
Date Command (Internal)
Purpose
This command is used to change or/and display current system date.
Example -
C:>DATE /t ↵
Mon 11/01/2021
C:>DATE ↵
The current date is: Mon 11/01/2021
Enter the new date: (mm-dd-yy) 11-01-2021
TIME Command (Internal)
This command is used to change or/and display current system time.
C:>TIME /t ↵ C:>TIME ↵
02:48 AM The current time is: 2:48:47.32
Enter the new time: 06:10:00
CLS Command(Internal)
This command is used to clear the screen.
Syntax : c:> cls ↵
COPY Command (Internal)
Purpose
This command is use to copy contents of a file1 to another file2. The
first filename you enter is referred to as the source file. The second filename you
enter is referred to as the target file.
Syntax
C:> COPY <Source filename> <Target file name>
Example –
C:> COPY RV.doc D:>MR.doc ↵
COPY CON (Internal)
COPY CON command is used to create a file in the existing directory. Here CON is
a DOS reserved word which stands for console.
C:>COPY CON [file_name] ↵
………
Your text will goes here....
^Z (CTRL+Z) OR F6 .. (to save file)
XCOPY Command (External)
Xcopy command copy directories.
Xcopy command copy all files including subdirectories of source directory.
Syntax
XCOPY Source_Directory Destination_directory
Example
C:> XCOPY C:RV d:VG ↵
EDIT Command (External)
EDIT command is used to open DOS Editor to create, display, modify files.
Options
/B - To open black and white mode.
/R - To open file in read only mode.
Syntax
C:>EDIT [/B|/R] [FILE_PATH]
1. C:>Edit ↵
2. C:>Edit/B about_us.txt ↵
3. C:>Edit/R about_us.txt ↵
4. C:>Edit about_us.txt ↵
Explanation
1: Opens DOS Editor.
2: Opens about_us.txt file in black and white dos editor.
3: Opens about_us.txt file in read only mode.
4: Open about_us.txt file in colored screen.
DEL/ERASE Command (Internal)
DEL/ERASE command is used to delete one or more than one file at a time.
Syntax
C:> Del [/Switch] [File Path]
Following switches can be use with this command.
/P : Display the confirmation message.
/F : Force deleting of read only files.
/A : Select file to delete based on attributes :
S : System files
R : read only files
H : Hidden files
A : ready for archiving
C:>DELETE/P D:SB.txt ↵ C:>ERASE/P D:includehelp.txt ↵
D:SB.txt, Delete (Y/N)? Y D:includehelp.txt, Delete (Y/N)? Y
REN /(Rename) Command (Internal)
This command is used to change the name of any file or directory.
Syntax:- C:> REN <Source filename> <Target filename>
C:>REN SB.TXT SBAC.TXT ↵
If we get successfully C: that means filename or directory name is get changed.
Either it will show the error message.
To changing the filename present in floppy disk
C:>REN A:SB.TXT SBAC.TXT ↵
Note that you cannot specify a new drive or path for your destination.
FORMAT Command (Internal)
This command is use to format a specified partition on a hard drive, floppy disk,
or flash drive to a specified file system.
Syntax
format <volume> [/fs:{FAT|FAT32|NTFS}] [/v:<label>] [/q] [/a:<unitsize>] [/c] [/x]
[/p:<passes>]
format <volume> [/v:<label>] [/q] [/f:<size>] [/p:<passes>]
format <volume> [/v:<label>] [/q] [/t:<tracks> /n:<sectors>] [/p:<passes>]
format <volume> [/v:<label>] [/q] [/p:<passes>]
format <volume> [/q]
Example
C:> Format D: /q ↵
Parameters –
/V[:label] Specifies the volume label.
/Q Performs a quick format.
/F:size Specifies the size of the floppy disk to format (such as 160, 180, 320, 360,
720, 1.2, 1.44, 2.88).
/B Allocates space on the formatted disk for system files.
/S Copies system files to the formatted disk.
/T:tracks Specifies the number of tracks per disk side.
/N:sectors Specifies the number of sectors per track.
/1 Formats a single side of a floppy disk.
/4 Formats a 5.25-inch 360K floppy disk in a high-density drive.
/8 Formats eight sectors per track.
/C Tests clusters that are currently marked "bad."
FIND Command (External)
FIND command is used to search for a file based on the contents inside it.
(Finds and reports the location of a specific string of text characters in one or more
files.)
Syntax
FIND [/V][/C][/I][/N] string [d:][path]filename[...]
Options
/V - Displays all lines not containing the specified string.
/C - Displays only the count of the number of lines that contained a match in each of
the files.
/I - Ignores the case of letters in the string search.
/N - Displays the found line preceded by the relative line number.
Example
C:> Find "Awesome" *.txt ↵
(Searches every text document in the current directory for the word “Awesome”.)
RESTORE Command (External)
Restores to standard disk storage format files previously stored using the
BACKUP command.
Syntax:
RESTORE d: [d:][path]filename [/P][/S][/B:mm-dd-yy] [/A:mm-dd-yy] [/E:hh:mm:ss]
[/L:hh:mm:ss] [/M][/N][/D]
Options
/P The program prompts you before it restores files that have been changed
since the last backup or files that are marked read-only. You can choose to
continue the restoration of that file or not.
/S Backed up files from both the specified source directory and from
subdirectories within that directory are transferred to the target path designation.
/B Only restores files that were modified on or BEFORE the date you enter.
/A Only restores files that were modified on or AFTER the date you enter.
/E Only restores files that were modified at or EARLIER than the time you enter.
/L Only restores files that were modified at or LATER than the given time.
/M Only restores files that have been modified since the last backup.
/N Only restores files that no longer exist on the destination disk.
/D Displays a list of the files on the backup disk that match the names specified
in filename without restoring any files. Even though no files are being restored,
you must specify the drive to which backed-up files will be restored when you use
/D.
Examples
C:> restore b: c:*.* /S ↵
To restore all the files from drive B to the root directory of drive C (and all
subdirectories within it)
C:> restore a: c:fileannual86 ↵
To restore the file ANNUAL86 from the backup disk in drive A to the FILES
directory on drive C
PROMPT Command (Internal)
This command Changes the DOS command prompt.
Syntax
PROMPT [prompt text] [options]
DOS PROMPT Characters
$b | $d system date
$e esc char $g >
$h destructive bk space $i <
$n default drive $p full path description
$q = $t system time
$v DOS version no $_ CR and LF
$$ the $ sign
Example
C:> PROMPT $$ ↵
This command displays $ as new prompt.
PATH Command (Internal)
Purpose: Sets or displays directories that will be searched for programs not in the
current directory.
Syntax:
PATH;
PATH [d:]path[;][d:]path[...]
Example:
C:>path c:program ↵
To tell DOS to search for external DOS commands and other executable programs in
the PROGRAM directory that is within the root directory on drive C, enter
C:> path program;filessales;data2
You can tell DOS to search more than one path by specifying several pathnames
separated by semicolons.
MORE Command (External)
Purpose: Sends output to console, one screen at a time.
Syntax:
MORE < (filename or command)
(name)|MORE
Example:
C:>more < sale2.txt ↵
To display the file SALE2.TXT, one screen full of data at a time
C:>TYPE (filename)|MORE ↵
To display the output of the TYPE command one screen at a time, you can enter the
command using the following format:
C:>type b:letterslet3.doc|more ↵
For example, to display the file LET3.DOC in the LETTERS directory on drive B,
TYPE Command (Internal)
Purpose
Displays the contents of a file.
Syntax
TYPE [d:][path]filename
Example
C:> type b:letter3.txt ↵
(To display the contents of the file LETTER3.TXT on drive B)
VER Command (Internal)
Displays the DOS version number.
C:> VER ↵
VOL Command (Internal)
Displays a disk`s volume label.
C:> vol d: ↵
To display the volume label for the disk in drive D ↵
CHKDSK Command (External)
Checks a disk and provides a file and memory status report.
Syntax
CHKDSK [d:][path][filename] [/F][/V]
Example
C:> chkdsk d: ↵
This will analyze the disk in drive D: and report a status message.
DISKCOMP Command (External)
Compares the contents of two diskettes.
Syntax
C:> DISKCOMP [d:] [d:][/1][/8]
Example
C:> Diskcomp a: b: /1 ↵ (Compares the first side of A: with B:)
C:> Diskcomp a: b: /8 ↵ (Compares the first 8 sectors per track.)
TREE Command (External)
Displays directory paths and (optionally) files in each subdirectory.
Syntax
TREE [Drive:[[Path] [/F] [/A]
/A - Specifies that alternative characters (plus signs, hyphens, and vertical bars) be
used to draw the tree diagram so that it can be printed by printers that don`t
support the line-drawing and box-drawing characters.
/F - Displays the names of the files found within each directory listed.
Example
C:> tree /F ↵
SYS Command (External)
Transfers the operating system files to another disk. The three files that are
transferred are IO.SYS, MSDOS.SYS, and COMMAND.COM
C:> SYS D: ↵
MEM Command (External)
Displays the amount of installed and available memory, including extended,
expanded, and upper memory.
C:> Mem ↵
http://www.rcppmail.org/DOS/internal_commands.htm#COPY%20CON
Directory related commands
MKDIR / MD Command (Internal)
This command allows to create a new directory.
Syntax
C:> MD <Dirname>
Example
C:> MKDIR RV ↵
C:> MD D:RT RV ↵
CD.. / CHDIR Command (Internal)
This command is use to change the current working directory.
RM / RMDIR Command (Internal)
This command is use to removes directories that are empty. (Any directories
deleted with the rmdir command cannot be recovered. Be very careful where and
how you use this command.)
Example
C:> RD C:newfiles ↵
To remove the directory NEWFILES from drive C
C:> RD C:newfilessales ↵
To remove the directory SALES that is within the NEWFILES directory on drive C
PRINT Command (External)
This command prints the data file.
External commands: - This commands are not permanent part of the memory. To
execute or run this commands an external file is required.
Example : [.] Dot exe, bat.
Some commonly used DOS external commands are .
1. CHKDSK:- The command CHkDsK returns the configuration status of the
selected disk. It returns the information about the volume, serial number, total disk
space, space in directories, space in each allocation unit, total memory and free
memory.
Syntax : - C : / > CHKDSK drive name
Eg:- C : / > CHKDSK e :
If drive name is not mentioned by default current drive is considered.
2. Diskcopy : - Disk copy command is used to make duplicate copy of the disk like
Xerox copy. It first formats the target disk and then copies the files by collection.
From the source disk and copied to the target disk.
Syntax : - C : / > disk copy < source path > < destination path >
Ex: - c : / > diskcopy A : B :
3. Format : - Format is used to erase information off of a computer diskette or
fixed drive.
Syntax : - C : / > format drive name
Ex : C : / > format A:
4. Label : This command is used to see volume label and to change volume label.
Syntax : C : / > label drive name
Ex : C : / > label A:
5. Scandisk : - This utility is used to repair and check various disk errors. It also
defects various physical disk errors and surface errors.
Syntax : - C : / > scandisk < drive names >
C : / > Scandisk A :
6. Move : The purpose of move is move to files from one place to another place.
Syntax: C : / > Move < source path > < target path >
7. Print : This command allowed users to print a text file to a line printer.
Syntax : C : / > Print < files name >
C : / > print Ramesh
8. Tree : This command displays the list of directories and files on specified path
using graphical display. It displays directories of files like a tree.
Syntax:- C : / > tree > path
C : / > tree A:
9. Deltree: This command is used to delete files a directories same as by the del
and RD commands. This command is more useful than del and RD commands
because it completely removes specified directories ie., disk with all it files and
sub – directories at a time.
Syntax:- C:/> deltree (path)
C:/> deltree A:/>ram
10. Sort: this command is used for sorting data and displaying the result on the
screen:
Syntax: C:>dir/sort/r (reverse order)
11. Sys: this command transfers MSDOS System files to specified areas to make
the disk bootable; Syntax: C:>Sys A:
12.
Pipes (|) it connects two files ie the standard output of one filter command
becomes standard input of another filter; eg Dir/Sort/ more ||
WildCard Characters - A wildcard character is a special character that represents
one or more other characters. The most commonly used wildcard characters are
the asterisk (*), which typically represents zero or more characters in a string of
characters, and the question mark (?), which typically represents any one
character.
For example, in searching:
run*
would mean "any word that starts with 'run' and has any kind of ending." If
you entered "run*" at a search engine that offered a wildcard character capability,
you would get results for run, runs, running, runner, runners - in short, any
possible word that might begin with the three letters.
Wildcard characters are used in regular expressions (a form of
programming in which input data is modified based on specified patterns) and in
searching through file directories for similar file names (for example, if all the
work files on a project start with the characters "P5," you could easily locate all
the project files by simply searching for "P5*").
A wildcard character is a type of meta character . In various games of
playing cards, a wild card is a designated card in the deck of cards (for example,
the two of spades) that can be used as though it were any possible card.
Alternatively referred to as a wild character or wildcard character, a
wildcard is a symbol used to replace or represent one or more characters. The
most common wildcards are the asterisk (*), which represents one or more
characters and question mark (?) that represents a single character.
MS-DOS and Windows command line wildcard examples
C:> dir c?mp
List files in MS-DOS using the dir command that contain c, mp, and any other
character in-between. For example, comp, camp, c2mp, and c-mp would all be
matched.
C:> dir *.mp3
In this next example, the dir command would only list files that end with .MP3 file
extension.
C:> dir *data
List any file that ends with data using the dir command. For example, the files
"appdata," "mydata," and "123data" would all be matched.
dir he??.*
List any file that is four characters long, begins with he, and has any extension. For
example, help.txt, help.mp3, and heck.jpg would all be matched.
rename *.txt *.jpg
Rename all files in the current directory that end with the file extension .txt to
.jpg. For example, the file test.txt would become test.jpg.
del comp*.txt
Deleting files in MS-DOS that begin with comp and end with a ".txt" extension.
The autoexec.bat and the config.sys were files created for MS-DOS to load
device and operating system files to properly run. These files are required for later
revisions of MS-DOS to load.
A batch file is a file that contains a sequence of commands for a
computer operating system. It's called a batch file because it batches (bundles or
packages) into a single file a set of commands that would otherwise have to be
presented to the system interactively from a keyboard one at a time. A batch file is
usually created for command sequences for which a user has a repeated need.
Commonly needed batch files are often delivered as part of an operating system. You
initiate the sequence of commands in the batch file by simply entering the name of
the batch file on a command line.
Using batch files
With batch files, which are also called batch programs or scripts, you can
simplify routine or repetitive tasks. A batch file is an unformatted text file that
contains one or more commands and has a .bat or .cmd file name extension. When
you type the file name at the command prompt, Cmd.exe runs the commands
sequentially as they appear in the file.
You can include any command in a batch file. Certain commands, such
as for, goto, and if, enable you to do conditional processing of the commands in the
batch file. For example, the if command carries out a command based on the results
of a condition. Other commands allow you to control input and output and call other
The standard error codes that most applications return are 0 if no error
occurred and 1 (or higher value) if an error occurred. Please refer to your
application help documentation to determine the meaning of specific error
codes.
https://www.ionos.com/digitalguide/server/tools/creating-a-batch-file/
https://www.computerhope.com/issues/ch001666.htm
https://searchwindowsserver.techtarget.com/tip/Creating-batch-files-using-the-
DOS-Copy-Con-command
https://www.tutorialspoint.com/batch_script/batch_script_quick_guide.htm
http://www.hermit.cc/it/dos/batfile.htm
CONFIG.SYS is a text file containing DOS (Disk Operating System)
commands that tell the operating system how the computer is initially set up.
More specifically, CONFIG.SYS commands specify memory device drivers and
programs that control hardware devices; enable or disable system features; and
set limits on system resources. CONFIG.SYS loads at startup before the
autoexec.bat (automatic execute.batch program) file. Because CONFIG.SYS is a
text file, it is editable in any text-editing program.
The CONFIG.SYS file is read every time a DOS system is booted. The
system then reads that file and executes the command following it. Users can
easily make changes as per their requirements by simply saving changes in the
CONFIG.SYS file. Since it is a text file, it can be edited it in any editing program.
This file is located in the root directory of the drive; this is the same location from
where system is booted.
The most common commands in the CONFIG.SYS file include:
BUFFERS= This command is used to specify the buffer size.
FILES= This command is used to determine the number of files that a user can
open simultaneously.
BREAK ON / OFF Command (Internal)
Used from the DOS prompt or in a batch file or in the CONFIG.SYS file to set (or
display) whether or not DOS checks for a Ctrl + Break key combination.
Discussion
DOS normally detects a press of the Ctrl + Break or Ctrl + C key
combination only while checking for keyboard input or while sending characters
to the screen.
Some application programs automatically reset BREAK (either ON or
OFF); this will cancel the BREAK options you set.
Syntax
Enter
break on
to tell DOS to check for the Ctrl + C key combination. To determine the current
BREAK setting, enter
break
BUFFER Command (Internal)
Used in the CONFIG.SYS file to set the number of disk buffers (a number from 1
to 99) that will be available for use during data input. Also used to set a value for
the number of sectors to be read in advance (read-ahead) during data input
operations.
Discussion
While conducting input and output operations, DOS stores information in
memory buffers so that it will be readily available when requested by an
application. The more buffers set in the CONFIG.SYS file with the BUFFERS
command, the faster DOS will be able to access the information requested. You
should experiment to determine the most efficient number of buffers for your
computer and the applications you are running. The same is true for determining
the appropriate number of read-ahead buffers. The read ahead buffers determine
the amount of data DOS will read from the disk in addition to the data requested
by the application.
Syntax
BUFFERS=(number),(read-ahead number) break on
buffers=20,2
To set buffers to 20 and read-ahead buffers to 2 enter the above line in your
CONFIG.SYS file
FILES Command (Internal)
Used in the CONFIG.SYS file to specify the maximum number of files that can be
open at the same time.
Discussion
You should specify a FILES= value of at least 20 to satisfy most of today`s
application programs. Some programs, such as Windows, may require as many as
30 or 40 files. If you have not allocated enough files for an application, an error
message may be displayed. If this happens, increase the number of files available
and restart your computer. You should be aware that some programs change the
FILES= value in your CONFIG.SYS file automatically. After installing a new
program, be sure to check your CONFIG.SYS file to make sure the setting will
work with your other applications.
Syntax
FILES=(number)
files=40
To set the maximum number of files that can be open at the same time to 40,
enter the above in your CONFIG.SYS file:
SHELL Command (Internal)
Used in the CONFIG.SYS file to specify the command interpreter that DOS should
use.
Discussion
In most cases DOS will use the command interpreter COMMAND.COM. If
you are using another command interpreter, or if DOS is not in the root directory,
you can use the SHELL command to tell DOS the name and location of the other
command interpreter.
Syntax
SHELL=[d:][path]filename [parameters]
shell=c:altdosndos.com
To use a command interpreter called NDOS.COM, located in the ALTDOS
directory, enter the above line in your CONFIG.SYS file:
ECHO Command (Internal)
Purpose: Turns on or off the display of commands in a batch file. Can also be used to
display a message in a batch file.
Discussion
Normally, commands in a batch file are displayed as the batch file runs. ECHO
OFF turns off this feature. ECHO ON turns the display feature back on.
If you enter the ECHO command with no options , the program will display
the current ECHO setting.
Syntax:
ECHO on|off
ECHO (message)
echo off
echo This is file one
If you want to display the message This is file one during the execution of a batch file,
but you do not want to display the commands being acted upon, enter
PAUSE Command (Internal)
Suspends execution of a batch file until a key is pressed.
PAUSE suspends execution of the batch file and displays the message
Strike a key when ready ...
pause Insert the target diskette in drive A
To suspend execution of a batch file and display the message Insert the target
diskette in drive A, enter
CALL command (Internal)
Calls another batch file and then returns to the current batch file to continue
processing.
Syntax:
CALL [d:][path]batchfilename [options ]
Used within a batch file to specify the name of another batch file (a file with the
.BAT filename extension). The original batch file calls into action the CALLed batch
file. When the CALLed batch file ends, control is transferred back to the original
batch file.
call starter
call tester
call finish
To run the files STARTER.BAT, TESTER.BAT, and FINISH.BAT in sequence, enter the
above three lines in your batch file:
IF Command (Internal)
Allows for conditional operations in batch processing.
Syntax:
IF [NOT] EXIST filename (command) [parameters]
IF [NOT] (string1)==(string2) (command) [parameters]
IF [NOT] ERRORLEVEL (number) (command) [parameters]
Discussion
When used in combination with the GOTO command, the IF command provides a
way to transfer control within a batch file dependent on the outcome of a test.
For more information on IF and other batch commands.
The IF test is indicated by the condition label in the command format. It can be
one of three types:
Condition 1: IF [NOT] EXIST (filename) (command)
This condition is determined by a test to see if a file exists (or does not
exist) on disk.
When this conditional test is included (it can be on any line of your batch
file), DOS checks to determine if the specified file exists (you must specify the
path so DOS can find the file). If the condition is true (as stated), the specified
command is executed. If the condition is found to be false, the command is not
acted on and processing proceeds to the next line in the batch file.
When the IF command is used together with the GOTO command, it provides a
way to transfer control to a different line in the batch file dependent on the
outcome of the test.
For example, to display a warning message only if the file DATA.1 does not exist
in the current directory, enter
echo off
if not exist data.1 goto MESSAGE
echo The file DATA.1 exists on the current directory
goto END
MESSAGE
echo The file DATA.1 was not found.
echo The file must be in the current directory
:END
When you enter the name of this batch file, there are two possible outcomes. If
the file DOES NOT EXIST in the current directory, the program will display:
echo off
The file DATA.1 was not found.
The file must be on the current directory
If the file DOES EXIST in the current directory, the program will display:
echo off
echo The file DATA.1 exists on the current directory.
In this example, the IF command is combined with the GOTO command to
determine the optional branching. The command tells DOS to check the current
disk to determine if the file DATA.1 exists. Since we are using the NOT EXIST form
of the command, the condition is true if it DOES NOT find the file; since the
condition is true, the specified command (in this case, the GOTO command) is
acted on. The GOTO MESSAGE line passes processing to the :MESSAGE label and
the messages on the following lines are displayed.
Condition 2: IF [NOT] string1==string2 (command)
This operation checks to determine if the first string you enter is equal (or is NOT
equal) to the second string you enter. If the condition is true (as stated), the specified
command will be carried out.
DOS judges this condition based on whether or not the two strings are EXACTLY
identical. DOS WILL detect a difference between uppercase and lowercase letters.
You can create a very useful version of the IF command that checks to determine
whether or not a parameter was passed to the batch file from the command line.
The following batch file acts conditionally depending on a test of whether or not
any characters were entered on the command line after the batch file name.
echo off
if not x==%1x goto PRINT
echo You must enter a parameter immediately after batch file name
goto END
:PRINT
echo The passed parameter is [ %1 ]
:END
The first line of this batch file checks to determine whether or not a parameter
has been passed at the command line. It uses the IF command to determine if
string one (the character `x`) is equal to string two (the character `x` plus the %1
symbol that represents the first passed parameter). If a parameter WAS passed to
the batch file, the two strings will not match and the condition, (stated as NOT
equal) is true; the GOTO command will be acted on, transferring processing to
the label :PRINT.
If the condition is found to be false (the two strings ARE equal), it means a
parameter WAS NOT entered on the command line. In that case, the GOTO
command on the same line as the IF command will not be acted on and
processing will be transferred to the next line of the batch file. The next line
includes the message You must enter a parameter immediately after the batch
file name. The following line transfers the processing to the :END label and the
program terminates.
If characters WERE entered after the batch filename, the program will display
echo off
The passed parameter is [ test ]
If characters WERE NOT entered after the batch filename, the program will display
echo off
You must enter a parameter immediately after batch file name
Condition 3: IF [NOT] ERRORLEVEL (number) (command)
This operation checks to determine if an ERRORLEVEL number is set (or is NOT set) at
or greater than the specified value. The ERRORLEVEL number is set by programs and
the value is retained in the computer`s memory. This command is used to check that
value. DOS judges this condition to be true if the ERRORLEVEL code is equal to OR
GREATER than the number you specify.
A common use of the IF command is to display a message to indicate that an ERRORLEVEL has
been set. To display a message whenever any ERRORLEVEL number has been set (any value
above zero), enter:
echo off
if errorlevel 1 echo The errorlevel is now greater than zero
When this line is acted on (and if the ERRORLEVEL is found to be set to a value), the ECHO
command will be acted on and the program will display
echo off
The errorlevel is now greater than zero
If DOS does not find a value set for ERRORLEVEL, the program terminates without displaying the
message.
GOTO Command (Internal)
Purpose: Causes unconditional branch to the specified label.
Syntax:
GOTO (label)
Discussion
Sends the program to the command found in the line immediately after
the label definition.
A label is the first eight characters on a batch file line after a colon. The
label can be indented, as long as there are only spaces preceding it on that line.
The label (the string of eight characters) can include spaces but not other
restricted characters such as commas, semicolons, or equal signs.
A label name after a GOTO command transfers processing to the line
containing the label. If a label is not found (or if the label contains illegal
characters), an error message is displayed and the batch file terminates.
:START
echo This is an infinite loop goto START
To create a batch file that will function as an infinite loop displaying the message This is an
D
D
D
D
D
https://www.w3schools.com/whatis/whatis_cli.asp
http://www.gf.unsa.ba/portal/informatika/DOS-examples.pdf
https://eml.berkeley.edu/sst/basic.dos.html
http://w3schools.org.in/dirhlp.htm
http://behtek.com/SM/MS-DOS.pdf
http://shinetutorial.com/ftp.htm
D

More Related Content

Similar to Operating System - I.pptx

The purpose of an operating system
The purpose of an operating systemThe purpose of an operating system
The purpose of an operating system11southongeorgeb
 
The purpose of an operating system
The purpose of an operating systemThe purpose of an operating system
The purpose of an operating system11southongeorgeb
 
unit 3.pptx
unit 3.pptxunit 3.pptx
unit 3.pptx
DivyaKS12
 
Computer system software
Computer system softwareComputer system software
Computer system software
MozaSaid
 
LESSON-2.pptx
LESSON-2.pptxLESSON-2.pptx
LESSON-2.pptx
ARDEN16
 
Vskills c++ developer sample material
Vskills c++ developer sample materialVskills c++ developer sample material
Vskills c++ developer sample material
Vskills
 
System Software
System SoftwareSystem Software
System Software
NaqashAhmad14
 
Computet scienceComputet scienceComputet science
Computet scienceComputet scienceComputet scienceComputet scienceComputet scienceComputet science
Computet scienceComputet scienceComputet science
ifrahabdikadir265
 
Computer Programs & System Softwares
Computer Programs & System SoftwaresComputer Programs & System Softwares
Computer Programs & System Softwares
Abijah Naresh Jumani
 
system software and application software
system software and application softwaresystem software and application software
system software and application software
Tallat Satti
 
Application software
Application softwareApplication software
Application software
sravani ponnuru
 
Features Of A Operating System
Features Of A Operating SystemFeatures Of A Operating System
Features Of A Operating System
Alexis Naranjo
 
Computer Notes
Computer NotesComputer Notes
Computer Notes
EHSAN KHAN
 
operating system college
operating system collegeoperating system college
operating system college
Jitendra Rawat
 
ESSENTIAL COMPONENTS OF COMPUTERS(UNIT 2)
ESSENTIAL COMPONENTS OF COMPUTERS(UNIT 2)ESSENTIAL COMPONENTS OF COMPUTERS(UNIT 2)
ESSENTIAL COMPONENTS OF COMPUTERS(UNIT 2)
SURBHI SAROHA
 
Introduction of OS & Classification of Software
Introduction of OS & Classification of SoftwareIntroduction of OS & Classification of Software
Introduction of OS & Classification of Software
Vpmv
 
unit 3.ppt
unit 3.pptunit 3.ppt
unit 3.ppt
prakashvs7
 
Computer software
Computer softwareComputer software
Computer software
Chahat Jain
 
System Software and Programming.pptx
System Software and Programming.pptxSystem Software and Programming.pptx
System Software and Programming.pptx
VanshikaPatel41
 
Os by nishant raghav
Os by nishant raghavOs by nishant raghav
Os by nishant raghav
Nishant Raghav
 

Similar to Operating System - I.pptx (20)

The purpose of an operating system
The purpose of an operating systemThe purpose of an operating system
The purpose of an operating system
 
The purpose of an operating system
The purpose of an operating systemThe purpose of an operating system
The purpose of an operating system
 
unit 3.pptx
unit 3.pptxunit 3.pptx
unit 3.pptx
 
Computer system software
Computer system softwareComputer system software
Computer system software
 
LESSON-2.pptx
LESSON-2.pptxLESSON-2.pptx
LESSON-2.pptx
 
Vskills c++ developer sample material
Vskills c++ developer sample materialVskills c++ developer sample material
Vskills c++ developer sample material
 
System Software
System SoftwareSystem Software
System Software
 
Computet scienceComputet scienceComputet science
Computet scienceComputet scienceComputet scienceComputet scienceComputet scienceComputet science
Computet scienceComputet scienceComputet science
 
Computer Programs & System Softwares
Computer Programs & System SoftwaresComputer Programs & System Softwares
Computer Programs & System Softwares
 
system software and application software
system software and application softwaresystem software and application software
system software and application software
 
Application software
Application softwareApplication software
Application software
 
Features Of A Operating System
Features Of A Operating SystemFeatures Of A Operating System
Features Of A Operating System
 
Computer Notes
Computer NotesComputer Notes
Computer Notes
 
operating system college
operating system collegeoperating system college
operating system college
 
ESSENTIAL COMPONENTS OF COMPUTERS(UNIT 2)
ESSENTIAL COMPONENTS OF COMPUTERS(UNIT 2)ESSENTIAL COMPONENTS OF COMPUTERS(UNIT 2)
ESSENTIAL COMPONENTS OF COMPUTERS(UNIT 2)
 
Introduction of OS & Classification of Software
Introduction of OS & Classification of SoftwareIntroduction of OS & Classification of Software
Introduction of OS & Classification of Software
 
unit 3.ppt
unit 3.pptunit 3.ppt
unit 3.ppt
 
Computer software
Computer softwareComputer software
Computer software
 
System Software and Programming.pptx
System Software and Programming.pptxSystem Software and Programming.pptx
System Software and Programming.pptx
 
Os by nishant raghav
Os by nishant raghavOs by nishant raghav
Os by nishant raghav
 

Recently uploaded

Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 

Recently uploaded (20)

Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 

Operating System - I.pptx

  • 2. Software and Hardware – Hardware - Hardware refers to the physical components of a computer. Computer Hardware is any part of the computer that we can touch these parts (tangible in nature). These are the primary electronic devices used to build up the computer. Examples of hardware in a computer are the Processor, Memory devices, Monitor, Printer, Keyboard, Mouse, and the Central Processing Unit. Software - Software is a collection of programming code installed on our computer's hard drive. Software is a set of instruction that tells a computer exactly what to do. Software is a collection of instructions, procedures, documentation that performs different tasks on a computer system. We can say also Computer Software is a programming code executed on a computer processor. The code can be machine-level code or the code written for an operating system. Software is intangible in nature. Examples of software are Ms Word, Excel, Power Point, Google Chrome, Photoshop, MySQL etc. Basically there are two types of software Application software and System software. Application Software - Application Software is a program that does real work for the user. It is mostly created to perform a specific task for a user. Application Software acts as a mediator between the end-user and System Software. It is also known as an application package. This type of software is written using a high-level language like C, Java, VB. Net, etc. It is a user-specific and is designed to meet the requirements of the user. We can also install multiple Application Software on a single System Software. You can store this kind of software on CDs, DVDs, flash derive, or keychain storage devices. Example: Word-processing, Spreadsheet, Database, etc.
  • 3. System Software - System Software is the type of software which is the interface between application software and system. Low level languages are used to write the system software. System Software maintain the system resources and give the path for application software to run. An important thing is that without system software, system can not run. It is a general purpose software. System software provides an interface between the system hardware and the user. It lets the system understand the command that the user inputs. We can also say that the system software serves as an interface between the hardware in a system and application software. It is also called as general purpose software. The end user usually does not directly interact with the system software. The user only gets to interact with the GUI that has been created by the system software. The main difference between System Software and Application Software is that without system software, system can not run on the other hand without application software, system always runs. There is one another type of software i.e. called as Utility software. Utility Software - Serve as tools for doing system maintenance and repairs not handled by operating system Utilities make it easier for users to: • Copy files between storage devices • Repair damaged data files • Translate files so different programs can read them • Guard against viruses and other harmful programs • Compress files so they take up less space
  • 4. An Operating System is a program that acts as an intermediary/interface between a user and the computer. An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers. An operating system, or "OS," is software that communicates with the hardware and allows other programs to run. It is comprised of system software, or the fundamental files your computer needs to boot up and function. Every desktop computer, tablet, and smartphone includes an operating system that provides basic functionality for the device. Common desktop operating systems include Windows, OS X, and Linux. While each OS is different, most provide a graphical user interface, or GUI, that includes a desktop and the ability to manage files and folders. They also allow you to install and run programs written for the operating system. Windows and Linux can be installed on standard PC hardware, while OS X is designed to run on Apple systems. Therefore, the hardware you choose affects what operating system(s) you can run. Mobile devices, such as tablets and smartphones also include operating systems that provide a GUI and can run applications. Common mobile OSes include Android, iOS, and Windows Phone. These OSes are developed specifically for portable devices and therefore are designed around touchscreen input. While early mobile operating systems lacked many features found in desktop OSes, they now include advanced capabilities, such as the ability to run third-party apps and run multiple apps at once. Other operating systems are VMS, OS/400, AIX, z/OS.
  • 5. Since the operating system serves as a computer's fundamental user interface, it significantly affects how you interact with the device. Therefore, many users prefer to use a specific operating system. For example, one user may prefer to use a computer with OS X instead of a Windows-based PC. Another user may prefer an Android-based smartphone instead of an iPhone, which runs the iOS. When software developers create applications, they must write and compile them for a specific operating system. This is because each OS communicates with the hardware differently and has a specific application program interface, or API, that the programmer must use. While many popular programs are crossplatform, meaning they have been developed for multiple OSes, some are only available for a single operating system. Therefore, when choosing a computer, make sure the operating system supports the programs you want to run.
  • 6. Operating System Structure Where Does an Operating System Live? A bootup program usually stores in ROM, loads the operating system from disk into the main memory of the computer when the machine is started or reset. Once loaded, some portions of it remain permanently in RAM while the computer is running and executing different user jobs. It therefore, shares the memory with the jobs that are currently running. Since an operating system is very large, other portions of the system are swapped in and out of memory when and where required by the user.
  • 7. The Operating System When you turn on the computer, the CPU automatically begins executing instructions stored in ROM. The operating system (OS) loads from the disk into part of the system’s memory.
  • 8. The Operating System (cont.) The OS loads the application program into memory and remains in memory, so it can provide services to the application program—display on-screen menus, communicate with the printer, and perform other common actions. The Operating System (cont.)
  • 9. NeCessityof operatingsystem Following are the points that justify the need and importance of an operating system  Operating system behaves as a resource manager. It utilizes the computer in a cost effective manner. It keeps account of different jobs and the where about of their results and locations in the memory.  It schedules jobs according to their priority passing control from one program to the next. The overall function of job control is especially important where there are several users (a multi user environment).  Operating system makes a communication link between user and the system and helps the user to run application programs properly and get the required output.  Operating system has the ability to fetch the programs in the memory when required and not all the operating system to be loaded in the memory at the same time. Thus giving the user the space to work in the required package more conveniently and easily.  Operating system helps the user in file management, making of directions, and saving files in them, is a very good feature provided by the operating system to organize data according to the needs of the user.  Multiprogramming is a very important feature of operating system. It schedules and controls the running of several programs at once.  It provides program editors that help the user to modify and update the program lines.  Debugging aids provided by the operating system help the user to detect and rename errors in programs  Disk maintenance ability of operating system checks the validity of data stored on diskettes and perhaps make corrections to erroneous data.
  • 10. Other Important Activities of Operating System Security − By means of password and similar other techniques, it prevents unauthorized access to programs and data. Control over system performance − Recording delays between request for a service and response from the system. Job accounting − Keeping track of time and resources used by various jobs and users. Error detecting aids − Production of dumps, traces, error messages, and other debugging and error detecting aids. Coordination between other softwares and users − Coordination and assignment of compilers, interpreters, assemblers and other software to the various users of the computer systems. Basically, an Operating System has three main responsibilities: (a) Perform basic tasks such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as disk drives and printers. (b) Ensure that different programs and users running at the same time do not interfere with each other. (c) Provide a software platform on top of which other programs can run.
  • 11. Functionsof operatingsystem The main functions perform by most Operating System of today are as follow: - 1. Process Management: - The process management module of an Operating System takes care of the creation & deletion of processes, scheduling of various system resources to the different process requesting them, & providing mechanism for synchronization & communication among processes. 2. Memory Management: - The memory management module of an Operating System takes care of the allocation & reallocation of memory space to the various program in need of this resource. 3. File Management: - computer use a lot of data & programs, which are, stored on secondary storage devices. File management functions of an Operating System. Involves keeping track of all different files & maintaining the integrity of data stored in the files including file directory structure. 4. Security: - The security modules of an Operating System protect the resources & information of a computer system against destruction& unauthorized access. 5. Command Interpretation: -The Command Interpretation module of an Operating System takes care of interpreting of user commands, & directing the system resources to handle the requests. With this mode of interaction with the system, the user is usually not too concerned with the hardware details of the system.
  • 12. 6. Input/Output or Device Management: - coordination & control of various input & output devices is an important function of the Operating System. This involves receiving the request for I/O interrupts, & communicating back to the requesting process. 7. Job Control: - When the user wants to run an application program, he must communicate with the Operating System telling it what to do. He does this using Operating System job control language or JCL. JCL consists of a number of Operating Systems commands, called system commands that control the functioning of the Operating System.
  • 13. Memory management Memory management is the functionality of an operating system which handles or manages primary memory and moves processes back and forth between main memory and disk during execution. Memory management keeps track of each and every memory location, regardless of either it is allocated to some process or it is free. It checks how much memory is to be allocated to processes. It decides which process will get memory at what time. It tracks whenever some memory gets freed or unallocated and correspondingly it updates the status. Main Memory refers to a physical memory that is the internal memory to the computer. The word main is used to distinguish it from external mass storage devices such as disk drives. Main memory is also known as RAM. The computer is able to change only data that is in main memory. Therefore, every program we execute and every file we access must be copied from a storage device into main memory. All the programs are loaded in the main memeory for execution. Sometimes complete program is loaded into the memory, but some times a certain part or routine of the program is loaded into the main memory only when it is called by the program, this mechanism is called Dynamic Loading, this enhance the performance.
  • 14. Also, at times one program is dependent on some other program. In such a case, rather than loading all the dependent programs, CPU links the dependent programs to the main executing program when its required. This mechanism is known as Dynamic Linking.
  • 15. • It allows you to check how much memory needs to be allocated to processes that decide which process should get memory at what time. • Tracks whenever inventory gets freed or unallocated. According to it will update the status. • It allocates the space to application routines. • It also make sure that these applications do not interfere with each other. • Helps protect different processes from each other • It places the programs in memory so that memory is utilized to its full extent. Swapping A process needs to be in memory for execution. But sometimes there is not enough main memory to hold all the currently active processes in a timesharing system. So, excess process are kept on disk and brought in to run dynamically. Swapping is the process of bringing in each process in main memory, running it for a while and then putting it back to the disk. Contiguous Memory Allocation In contiguous memory allocation each process is contained in a single contiguous block of memory. Memory is divided into several fixed size partitions. Each partition contains exactly one process. When a partition is free, a process is selected from the input queue and loaded into it.
  • 16. Memory Allocation Memory allocation is a process by which computer programs are assigned memory or space. It is of three types : First Fit: The first hole that is big enough is allocated to program. Best Fit: The smallest hole that is big enough is allocated to program. Worst Fit: The largest hole that is big enough is allocated to program. Fragmentation Fragmentation occurs in a dynamic memory allocation system when most of the free blocks are too small to satisfy any request. It is generally termed as inability to use the available memory. In such situation processes are loaded and removed from the memory. As a result of this, free holes exists to satisfy a request but is non contiguous i.e. the memory is fragmented into large no. Of small holes. This phenomenon is known as External Fragmentation.
  • 17. Also, at times the physical memory is broken into fixed size blocks and memory is allocated in unit of block sizes. The memory allocated to a space may be slightly larger than the requested memory. The difference between allocated and required memory is known as Internal fragmentation i.e. the memory that is internal to a partition but is of no use. Paging A solution to fragmentation problem is Paging. Paging is a memory management mechanism that allows the physical address space of a process to be non-contagious. Here physical memory is divided into blocks of equal size called Pages. The pages belonging to a certain process are loaded into available memory frames. Segmentation Segmentation is another memory management scheme that supports the user-view of memory. Segmentation allows breaking of the virtual address space of a single process into segments that may be placed in non-contiguous areas of physical memory.
  • 18. Memory Protection Memory protection is a phenomenon by which we control memory access rights on a computer. The main aim of it is to prevent a process from accessing memory that has not been allocated to it. Hence prevents a bug within a process from affecting other processes
  • 19. Types of Computer Memories: Memory is the best essential element of a computer because computer can’t perform simple tasks. The performance of computer mainly based on memory and CPU. Memory is internal storage media of computer that has several names such as majorly categorized into two types, Main memory and Secondary memory. 1. Primary Memory / Volatile Memory. 2. Secondary Memory / Non Volatile Memory. 1. Primary Memory / Volatile Memory: Primary Memory also called as volatile memory because the memory can’t store the data permanently. It also has another name i.e. RAM. Random Access Memory (RAM): The primary storage is referred to as random access memory (RAM) due to the random selection of memory locations. It performs both read and write operations on memory. If power failures happened in systems during memory access then you will lose your data permanently. So, RAM is volatile memory. RAM is of two types − Static RAM (SRAM) Dynamic RAM (DRAM)
  • 20. Static RAM (SRAM) The word static indicates that the memory retains its contents as long as power is being supplied. Dynamic RAM (DRAM) DRAM, unlike SRAM, must be continually refreshed in order to maintain the data. DRAM is used for most system memory as it is cheap and small. Secondary Memory / Non Volatile Memory: Secondary memory is external and permanent memory that is useful to store the external storage media such as floppy disk, magnetic disks, magnetic tapes and etc cache devices. Secondary memory deals with following types of components. Read Only Memory (ROM) : ROM is permanent memory location that offer huge types of standards to save data. But it work with read only operation. No data lose happen whenever power failure occur during the ROM memory work in computers.
  • 21. The various types of ROMs are: MROM (Masked ROM) The very first ROMs were hard-wired devices that contained a pre- programmed set of data or instructions. These kind of ROMs are known as masked ROMs, which are inexpensive. PROM (Programmable Read Only Memory) PROM is read-only memory that can be modified only once by a user. The user buys a blank PROM and enters the desired contents using a PROM program. EPROM (Erasable and Programmable Read Only Memory) EPROM can be erased by exposing it to ultra-violet light for a duration of up to 40 minutes. Usually, an EPROM eraser achieves this function. EEPROM (Electrically Erasable and Programmable Read Only Memory) EEPROM is programmed and erased electrically. It can be erased and reprogrammed about ten thousand times.
  • 22. Cache Memory Cache memory is a very high speed semiconductor memory which can speed up the CPU. It acts as a buffer between the CPU and the main memory. It is used to hold those parts of data and program which are most frequently used by the CPU. The parts of data and programs are transferred from the disk to cache memory by the operating system, from where the CPU can access them.
  • 23. Device Management An OS manages device communication via their respective drivers. It performs the following activities for device management. Keeps tracks of all devices connected to system. designates a program responsible for every device known as the Input/Output controller. Decides which process gets access to a certain device and for how long. Allocates devices in an effective and efficient way. Deallocates devices when they are no longer required. User Level Operating System Level Hardware Level An OS manages device communication via their respective drivers. It performs the following activities for device management. Keeps tracks of all devices connected to system. designates a program responsible for every device known as the Input/Output controller. Decides which process gets access to a certain device and for how long. Allocates devices in an effective and efficient way. Deallocates devices when they are no longer required. User applications Various OS components Device drivers Device controllers I/O devices
  • 24. One of the important jobs of an Operating System is to manage various I/O devices including mouse, keyboards, touch pad, disk drives, display adapters, USB devices, Bit-mapped screen, LED, Analog-to-digital converter, On/off switch, network connections, audio I/O, printers etc. User interact with machines by providing information through IO devices. Clearly, management of all these devices can affect the throughput of a system. For this reason, input output management also becomes one of the primary responsibilities of an operating system. An I/O system is required to take an application I/O request and send it to the physical device, then take whatever response comes back from the device and send it to the application. I/O devices can be divided into two categories − Block devices − A block device is one with which the driver communicates by sending entire blocks of data. For example, Hard disks, USB cameras etc. Character devices − A character device is one with which the driver communicates by sending and receiving single characters (bytes, octets). For example, serial ports, parallel ports, sounds cards etc. Network device - For transmitting data packets. When we analyze device communication, we notice that communication is required at the following three levels: - The need for a human to input information and receive output from a computer. The need for a device to input information and receive output from a computer. The need for computers to communicate (receive/send information) over networks.
  • 25. An operating system or the OS manages communication with the devices through their respective drivers. The operating system component provides a uniform interface to access devices of varied physical attributes. For device management in operating system: Keep tracks of all devices and the program which is responsible to perform this is called I/O controller. Monitoring the status of each device such as storage drivers, printers and other peripheral devices. Enforcing preset policies and taking a decision which process gets the device when and for how long. Allocates and Deallocates the device in an efficient way. De-allocating them at two levels: at the process level when I/O command has been executed and the device is temporarily released, and at the job level, when the job is finished and the device is permanently released. Optimizes the performance of individual devices.
  • 26. Device Management Functions The management of I/O devices such as printers, card readers, taps, disk and supporting devices such as control unit and control channel. The basic function of I/O devices are: 1. Track status of all devices which are requires special mechanism. 2. Deciding the policy on determine which process gets a device, for how long and where. There are three basic techniques for implementing a device for policy. 1. Dedicated : A technique where a device is assign to a single process. 2. Shared : A technique where a device shared by many processes. 3. Virtual : A technique where one physical device this simulated on another physical device. Its Combination of dedicated devices that have been transformed into shared devices. 3. Allocation : Physically ascending a device to process with controlling unit and channel. 4. De-allocation : De-allocate the devices at 2 levels. 1. On job level : A device assign only for as long as the job exits in the system. 2. On process level : A device assign only for as long as the process needs it.
  • 27. Device characteristics Devices can be categorizes into two groups. 1. Input/Output Device. 2. Storage devices. 1. Input/Output Devices : An input devices takes data from the outside world. An output device which produce data to the outside world. Example : Card reader (Input device) Printer (output Device) 2. Storage Device : It is a mechanism by which the computer may store the information in such a way that information may be retrieve at later time. There are following three types of storage devices. 1. Serial Access Devices. 2. Completely Direct Access. 3. Direct Access Storage device (DASD).
  • 28. 1. Serial Access Devices : It can be characterized as one that dependence on physical sequential positioning and accessing information. Example, Magnetic tap unit where information is stored as a group of byte called records of any length. Each record can be identify by it physical position on the tap Example, the first record is one second record is second and So on. 2. Completely direct access devices : A completely direct access devices is one in which the access time is constant. It requires less time and less cost. Example, Magnetic code memory, semiconductor memory 3.Direct Access storage device (DASD) : A direct access device is one that is characterized by small variances in the access time. These have been called direct access storage devices. Example :Magnetic drum and disk.
  • 29. Summary – An Operating System will have device drivers to facilitate I/O functions involving I/O devices. These device drivers are software routines that control respective I/O devices through their controllers. The Operating System is responsible for the following I/O Device Management Functions: Keep track of the I/O devices, I/O channels, etc. This module is typically called I/O traffic controller. Decide what is an efficient way to allocate the I/O resource. If it is to be shared, then decide who gets it, how much of it is to be allocated, and for how long. This is called I/O scheduling. Allocate the I/O device and initiate the I/O operation. Reclaim device as and when its use is through. In most cases I/O terminates automatically.
  • 30. Job scheduling Job scheduling is the process of allocating system resources to many different tasks by an operating system (OS). The system handles prioritized job queues that are awaiting CPU time and it should determine which job to be taken from which queue and the amount of time to be allocated for the job. This type of scheduling makes sure that all jobs are carried out fairly and on time. Most OSs like Unix, Windows, etc., include standard job-scheduling abilities. A number of programs including database management systems (DBMS), backup, enterprise resource planning (ERP) and business process management (BPM) feature specific job-scheduling capabilities as well. Job scheduling is performed using job schedulers. Job schedulers are programs that enable scheduling and, at times, track computer "batch" jobs, or units of work like the operation of a payroll program. Job schedulers have the ability to start and control jobs automatically by running prepared job-control- language statements or by means of similar communication with a human operator. Generally, the present-day job schedulers include a graphical user interface (GUI) along with a single point of control.
  • 31. Process scheduling is an essential part of a Multiprogramming operating systems. Such operating systems allow more than one process to be loaded into the executable memory at a time and the loaded process shares the CPU using time multiplexing. Process Scheduling Queues The OS maintains all Process Scheduling Queues. The OS maintains a separate queue for each of the process states and all processes in the same execution state are placed in the same queue. When the state of a process is changed, it is unlinked from its current queue and moved to its new state queue. The Operating System maintains the following important process scheduling queues − Job queue − This queue keeps all the processes in the system. Ready queue − This queue keeps a set of all processes residing in main memory, ready and waiting to execute. A new process is always put in this queue. Device queues − The processes which are blocked due to unavailability of an I/O device constitute this queue.
  • 32. Different job scheduling in operating systems. Job scheduling schedules or decides which process will get to acquire the resource based on some parameters. The OS can use different policies to manage each queue - FIFO- The process that comes first is executed first. - Shortest job First- The time taken to complete the job of all processes is computed and the shortest length process is executed first. - Round Robin- Each process gets a time “share” for running and is later prevented to get the next process running. This process is known as time sharing, which provides the effect of all the processes running at the same time. - Priority scheduling- Here, the process on highest priority gets the resource.
  • 33. Schedulers Schedulers are special system software which handle process scheduling in various ways. Their main task is to select the jobs to be submitted into the system and to decide which process to run. Schedulers are of three types − Long-Term Scheduler Short-Term Scheduler Medium-Term Scheduler Long Term Scheduler It is also called a job scheduler. A long-term scheduler determines which programs are admitted to the system for processing. It selects processes from the queue and loads them into memory for execution. Process loads into the memory for CPU scheduling. The primary objective of the job scheduler is to provide a balanced mix of jobs, such as I/O bound and processor bound. It also controls the degree of multiprogramming. If the degree of multiprogramming is stable, then the average rate of process creation must be equal to the average departure rate of processes leaving the system. On some systems, the long-term scheduler may not be available or minimal. Time-sharing operating systems have no long term scheduler. When a process changes the state from new to ready, then there is use of long-term scheduler.
  • 34. Short Term Scheduler It is also called as CPU scheduler. Its main objective is to increase system performance in accordance with the chosen set of criteria. It is the change of ready state to running state of the process. CPU scheduler selects a process among the processes that are ready to execute and allocates CPU to one of them. Short-term schedulers, also known as dispatchers, make the decision of which process to execute next. Short-term schedulers are faster than long-term schedulers. Medium Term Scheduler Medium-term scheduling is a part of swapping. It removes the processes from the memory. It reduces the degree of multiprogramming. The medium-term scheduler is in-charge of handling the swapped out-processes. A running process may become suspended if it makes an I/O request. A suspended processes cannot make any progress towards completion. In this condition, to remove the process from memory and make space for other processes, the suspended process is moved to the secondary storage. This process is called swapping, and the process is said to be swapped out or rolled out. Swapping may be necessary to improve the process mix.
  • 35. I/o management One of the important jobs of an Operating System is to manage various I/O devices including mouse, keyboards, touch pad, disk drives, display adapters, USB devices, Bit-mapped screen, LED, Analog-to-digital converter, On/off switch, network connections, audio I/O, printers etc. Humans interact with machines by providing information through IO devices. Clearly, management of all these devices can affect the throughput of a system. For this reason, input output management also becomes one of the primary responsibilities of an operating system. An I/O system is required to take an application I/O request and send it to the physical device, then take whatever response comes back from the device and send it to the application. I/O devices can be divided into two categories − Block devices − A block device is one with which the driver communicates by sending entire blocks of data. For example, Hard disks, USB cameras etc. Character devices − A character device is one with which the driver communicates by sending and receiving single characters (bytes, octets). For example, serial ports, parallel ports, sounds cards etc
  • 36. Issues in IO Management When we analyze device communication, we notice that communication is required at the following three levels: The need for a human to input information and receive output from a computer. The need for a device to input information and receive output from a computer. The need for computers to communicate (receive/send information) over networks. To meet these varied requirements, The basic idea is to select a mode of communication taking device characteristics into account or a need to synchronize with some event. Computers employ the following four basic modes of IO operation: 1. Programmed mode 2. Polling mode 3. Interrupt mode 4. Direct memory access mode.
  • 37. Programmed Data Mode - In this mode of communication, execution of an IO instruction ensures that a program shall not advance till it is completed. POLLING -In this mode of data transfer, the system interrogates each device in turn to determine if it is ready to communicate. If it is ready, communication is initiated and subsequently the process continues again to interrogate in the same sequence. Interrupt Mode - Let us begin with a simple illustration to explain the basic interrupt mode of data transfer. Suppose a program needs input from a device which communicates using interrupt. Even with the present-day technology the devices are one thousand or more times slower than the processor So if the program waits on the input device it would waste many processor cycles just waiting for the input device to be ready to communicate. This is where the interrupt mode starts At the time when the device is actually ready to establish an IO, the device raises an interrupt to seek communication. Immediately the program execution is suspended temporarily and current state of the process is stored. The control is passed on to an interrupt service routine (which may be specific to the device) to perform the desired input
  • 38. Direct memory access (DMA) is a feature of computer systems that allows certain hardware subsystems to access main system memory (Random-access memory), independent of the central processing unit(CPU). Without DMA, when the CPU is using programmed input/output, it is typically fully occupied for the entire duration of the read or write operation, and is thus unavailable to perform other work. DMA(Direct memory access) Mode of Data Transfer This is a mode of data transfer in which IO is performed in large data blocks. For instance, the disks communicate in data blocks of sizes like 512 bytes or 1024 bytes. The direct memory access, or DMA ensures access to main memory without processor intervention or support. Such independence from processor makes this mode of transfer extremely efficient.
  • 39. Resource management The various roles of an operating system generally revolve around the idea of "sharing nicely." An operating system manages resources, and these resources are often shared in one way or another among the various programs that want to use them. multiple programs executing concurrently share the use of main memory; they take turns using the CPU; and they compete for an opportunity to use input and output devices. There are various aspects or resources that require management in a computer system, including: primary memory and secondary memory, processor, bandwidth, graphics and sound, networks, and cache. A computer system has many resources, which are to be required to solve a computing problem. These resources are the CPU time, memory space, files storage space, input/output devices and so on. The Operating System acts as a manager of all of these resources and allocates them to the specific programs and users as needed by their tasks. Since there can be many conflicting requests for the resources, the Operating System must decide which requests are to be allocated resources to operate the computer system fairly and efficiently.
  • 40. The Operating System is a manager of system resources. A computer system has many resources as stated above. Since there can be many conflicting requests for the resources, the Operating System must decide which requests are to be allocated resources to operate the computer system fairly and efficiently. Here we present a framework of the study of Operating System based on the view that the Operating System is manager of resources. The Operating System as a resources manager can be classified in to the following three popular views: primary view, hierarchical view, and extended machine view. The primary view is that the Operating System is a collection of programs designed to manage the system’s resources, namely, memory, processors, peripheral devices, and information. It is the function of Operating System to see that they are used efficiently and to resolve conflicts arising from competition among the various users. The Operating System must keep track of status of each resource; decide which process is to get the resource, allocate it, and eventually reclaim it.
  • 41. Summary of Resource Management – Manages and protects multiple computer resources: CPU, Processes, Internal/External memory, Tasks, Applications, Users, Communication channels, etc… Handles and allocates resources to multiple users or multiple programs running at the same time and space (e.g., processor time, memory, I/O devices). Decides between conflicting requests for efficient and fair resource use (e.g., maximize throughput, minimize response time).
  • 42. Types of Operating systems Following are the popular types of Operating System: Batch Processing OS Multiprocessing OS Time Sharing OS Real Time OS Distributed OS Network OS Batch Processing OS In the era of 1970s, the Batch processing was very popular. The Jobs were executed in batches. People were used to have a single computer which was called mainframe. The system put all of the jobs in a queue on the basis of first come first serve and then executes the jobs one by one. The users collect their respective output when all the jobs get executed. In Batch operating system, access is given to more than one person; they submit their respective jobs to the system for the execution.
  • 43. The user of a batch operating system never directly interacts with the computer. In this type of OS, every user prepares his or her job on an offline device like a punch card and submit it to the computer operator. The programmers leave their programs with the operator and the operator then sorts the programs with similar requirements into batches. The problems with Batch Systems are as follows − 1) Lack of interaction between the user and the job. 2) CPU is often idle, because the speed of the mechanical I/O devices is slower than the CPU. 3) Difficult to provide the desired priority. 4) Starvation - Batch processing suffers from starvation. If there are five jobs J1, J2, J3, J4 and J5 present in the batch. If the execution time of J1 is very high then other four jobs will never be going to get executed or they will have to wait for a very high time. Hence the other processes get starved. 5) Not Interactive - Batch Processing is not suitable for the jobs which are dependent on the user's input. If a job requires the input of two numbers from the console then it will never be going to get it in the batch processing scenario since the user is not present at the time of execution.
  • 44. Multiprogramming Operating System – Multiprogramming is an extension to the batch processing where the CPU is kept always busy. Each process needs two types of system time: CPU time and IO time. In multiprogramming environment, for the time a process does its I/O, The CPU can start the execution of other processes. Therefore, multiprogramming improves the efficiency of the system. In this the operating system picks up and begins to execute one of the jobs from memory. Once this job needs an I/O operation operating system switches to another job (CPU and OS always busy). Jobs in the memory are always less than the number of jobs on disk(Job Pool). If several jobs are ready to run at the same time, then the system chooses which one to run through the process of CPU Scheduling. In Non-multiprogrammed system, there are moments when CPU sits idle and does not do any work. In Multiprogramming system, CPU will never be idle and keeps on processing.
  • 45. Time-sharing operating systems - Time Sharing Systems are very similar to Multiprogramming systems. In fact time sharing systems are an extension of multiprogramming systems. In Time sharing systems the prime focus is on minimizing the response time, while in multiprogramming the prime focus is to maximize the CPU usage. Time-sharing is a technique which enables many people, located at various terminals, to use a particular computer system at the same time. Time- sharing or multitasking is a logical extension of multiprogramming. Processor's time which is shared among multiple users simultaneously is termed as time- sharing. The main difference between Multiprogramming Systems and Time- Sharing Systems is that in case of Multiprogramming systems, the objective is to maximize processor use, whereas in Time-Sharing Systems, the objective is to minimize response time. Multiple jobs are executed by the CPU by switching between them, but the switches occur so frequently. Thus, the user can receive an immediate response. For example, in a transaction processing, the processor executes each user program in a short burst or quantum of computation. That is, if n users are present, then each user can get a time quantum. When the user submits the command, the response time is in few seconds at most.
  • 46. The operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of a time. Computer systems that were designed primarily as batch systems have been modified to time-sharing systems. Advantages of Timesharing operating systems are as follows − 1)Provides the advantage of quick response. 2)Avoids duplication of software. 3)Reduces CPU idle time. Disadvantages of Time-sharing operating systems are as follows − 1) Problem of reliability. 2) Question of security and integrity of user programs and data. 3) Problem of data communication.
  • 47. Real Time Operating System – In Real Time systems, each job carries a certain deadline within which the Job is supposed to be completed, otherwise the huge loss will be there or even if the result is produced then it will be completely useless. The Application of a Real Time system exists in the case of military applications, if you want to drop a missile then the missile is supposed to be dropped with certain precision. A real time operating system time interval to process and respond to inputs is very small. Examples: Military Software Systems, Space Software Systems are the Real time OS example. A real-time system is defined as a data processing system in which the time interval required to process and respond to inputs is so small that it controls the environment. The time taken by the system to respond to an input and display of required updated information is termed as the response time. So in this method, the response time is very less as compared to online processing. Real-time systems are used when there are rigid time requirements on the operation of a processor or the flow of data and real-time systems can be used as a control device in a dedicated application. A real-time operating system must have well-defined, fixed time constraints, otherwise the system will fail. For example, Scientific experiments, medical imaging systems, industrial control systems, weapon systems, robots, air traffic control systems, etc.
  • 48. There are two types of real-time operating systems. Hard real-time systems Hard real-time systems guarantee that critical tasks complete on time. In hard real-time systems, secondary storage is limited or missing and the data is stored in ROM. In these systems, virtual memory is almost never found. Soft real-time systems Soft real-time systems are less restrictive. A critical real-time task gets priority over other tasks and retains the priority until it completes. Soft real-time systems have limited utility than hard real-time systems. For example, multimedia, virtual reality, Advanced Scientific Projects like undersea exploration and planetary rovers, etc.
  • 49. Distributed Operating System – Distributed systems use many processors located in different machines to provide very fast computation to its users. Distributed systems use multiple central processors to serve multiple real-time applications and multiple users. Data processing jobs are distributed among the processors accordingly. The processors communicate with one another through various communication lines (such as high-speed buses or telephone lines). These are referred as loosely coupled systems or distributed systems. Processors in a distributed system may vary in size and function. These processors are referred as sites, nodes, computers, and so on. The advantages of distributed systems are as follows − 1) With resource sharing facility, a user at one site may be able to use the resources available at another. 2) Speedup the exchange of data with one another via electronic mail. 3) If one site fails in a distributed system, the remaining sites can potentially continue operating. 4) Better service to the customers. 5) Reduction of the load on the host computer. 6) Reduction of delays in data processing.
  • 50. The motivation behind developing distributed operating systems is the availability of powerful and inexpensive microprocessors and advances in communication technology. These advancements in technology have made it possible to design and develop distributed systems comprising of many computers that are inter connected by communication networks. The main benefit of distributed systems is its low price/performance ratio. Types of Distributed Operating Systems Following are the two types of distributed operating systems used: Client-Server Systems Peer-to-Peer Systems
  • 51. Network Operating Systems – A Network Operating System runs on a server and provides the server the capability to manage data, users, groups, security, applications, and other networking functions. The primary purpose of the network operating system is to allow shared file and printer access among multiple computers in a network, typically a local area network (LAN), a private network or to other networks. Examples of network operating systems include Microsoft Windows Server 2003, Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD. The advantages of network operating systems are as follows − Centralized servers are highly stable. Security is server managed. Upgrades to new technologies and hardware can be easily integrated into the system. Remote access to servers is possible from different locations and types of systems. The disadvantages of network operating systems are as follows − High cost of buying and running a server. Dependency on a central location for most operations. Regular maintenance and updates are required.
  • 52. Disk operating sytem (dos) DOS Stands for "Disk Operating System." DOS was the first operating system used by IBM-compatible computers. It was originally available in two versions that were essentially the same, but marketed under two different names. "PC-DOS" was the version developed by IBM and sold to the first IBM-compatible manufacturers. "MS-DOS" was the version that Microsoft bought the rights to, and was bundled with the first versions of Windows. DOS uses a command line, or text-based interface, that allows the user to type commands. By typing simple instructions such as pwd (print working directory) and cd (change directory), the user can browse the files on the hard drive, open files, and run programs. While the commands are simple to type, the user must know the basic commands in order to use DOS effectively (similar to Unix). This made the operating system difficult for novices to use, which is why Microsoft later bundled the graphic-based Windows operating system with DOS. The first versions of Windows (through Windows 95) actually ran on top of the DOS operating system. This is why so many DOS-related files (such as .INI, .DLL, and .COM files) are still used by Windows. However, the Windows operating system was rewritten for Windows NT (New Technology), which enabled Windows to run on its own, without using DOS. Later versions of Windows, such as Windows 2000, XP, and Vista, also do not require DOS.
  • 53. DOS is still included with Windows, but is run from the Windows operating system instead of the other way around. The DOS command prompt can be opened in Windows by selecting "Run..." from the Start Menu and typing cmd. DOS uses the File Allocation Table (FAT) filesystem. The purpose of the file allocation table is to keep track of where to find files on the disk. When someone say that their disk is NTFS or FAT, it actually refers to the file system that’s being used by the computer or more appropriately, the operating system. In MS-DOS, every DOS based partition has a letter: (A: or B: or C:). Typically, the drive letters A: and B: are reserved for floppy drives. You will most frequently find that the C: drive is the 'bootable partition'. Each drive has a root directory ('') so the root directory on a given drive looks like this: C: Changing drives is as simple as typing the name of the drive letter: A:> C: <enter> ↵ C:> MS-DOS then stores files to the system in any arrangement you choose. You can create directories, and store files within those directories. A typical file/path might look like this: C:ms-dosmydirR8.txt
  • 54. LIMITATIONS FAT16 filesystems are compatible with all Microsoft operating systems, but it has severe limitations. First, all files on the system are limited to eight characters and a three letter extension. The MS-DOS filesystem also has a limit of approximately 2.1 Gigabytes owing to the fact that the MS-DOS operating system doesn't recognize 'Int 13' based commands, and therefore cannot issue commands to access the remainder of larger disks. Keep in mind that MS-DOS is a legacy system kept around for doing command line based work in Windows. http://crdd.osdd.net/raghava/slides/prephd/doslec.htm https://www.includehelp.com/disk-operating-system-dos-commands.aspx https://ecomputernotes.com/fundamental/disk-operating-system/describe- the-commands-in-dos-name-the-commands-with-their-syntax http://www.ybet.be/en-operating/en-dos-2.php https://kb.iu.edu/d/aerh http://www.easydos.com/path.html http://www.easydos.com/dosindex.html https://www.tech-wonders.com/2011/06/most-commonly-used- internal-and.html http://www.rcppmail.org/DOS/internal_commands.htm#REn
  • 55. What is BOOTing ? When the computer is switched on, the firmware program in Read Only Memory(ROM) also called Basic Input-Output System(BIOS) reads programs and data i.e. Operating System and loads it into memory (RAM). This process is known Bootstrapping(Booting). The OS once loaded takes control of the computer, handles user interaction and executes application programs. Booting Sequence During Booting process, computer loads the operating system into its memory. DOS booting involves reading following files into memory namely IO.SYS, MSDOS.SYS, and COMMAND COM. The Basic Input/Output Program (IO.SYS): This program provides interface between the hardware devices and software of the system. It takes care of the keyboard input, character output to monitor, output to printer and time of the day. The File and Disk Manager Program (MSDOS.SYS) : It contains the file management and the disk buffering management capabilities. It keeps track of all the disk access of an application program and remains permanently in memory. The Command Processor (COMMAND.COM) : It is also called command interpreter. It is the program that displays the system prompt and handles user interface by executing the command typed in by the user using keyboard.
  • 56. Operating system as a User Interface:- There are mainly two types of O.S. as a user interface, these are following: · Graphical User Interface (GUI) · Command Line Interface (CLI) Graphical User Interface:- The GUI allows the user to select the desired option with the help of graphical images. This type of interface uses both images and menu to select commands ar initiate different operations. Generally these graphical images are called Icons, which are small pictorial figures representing different tasks, Procedures and programs. Command User Interface:- CUI can help the user to interact or communicate with the computer through different commands. In this type of Interface the user has to memorize so many commands or to refer book for different commands. It also takes time to type each commands. DOS supports the CLI (CLI stands for: Command Line Interface / Command Line Interpreter / Command Line Input). Today, every OS comes with graphical user interfaces (GUI), so most users are not aware about command-line interfaces (CLI). The user can store data or programs on secondary storage devices called Hard disk or Floppy disk. Physically disks store data by recording any pattern of magnetic changes on using a tiny read-write head that moves over the surface. Disk is divided into sectors and tracks.
  • 57. The first two characters of alphabet (a: or b:) are reserved for Floppy disks, Hard disks are identified by characters (c:) or (d:), the next character in the sequence is assigned to Compact Disk (CD-ROM) drive further the network drives connected to the system are assigned the remaining characters. The "default drive" is where DOS expects to find programs and data. DOS commands are preceded by a default drive designation (typically c:>). (As generally by default operating system is get installed on C dirve.) C:> is also called as system prompt. C drive is called as a default drive. A file is a set of information grouped under single name. File can be a address list, a set of receipes from kitchens or even an executable program. On DOS, a file that is stored on the disk hard (or a floppy disk) is designated by a name consisting of 1 to 8 digital - alphanumeric characters or special characters: $ & # @ ! % () - < > _ DOS uses the File Allocation Table (FAT) filesystem. The file name is followed by an extension of 3-character maximum. DOS does not distinguish between uppercase and lowercase letters. The organization of the data on the hard drive (to a lesser extent the floppy) is done by directories and subdirectories. These directories can gather the data in specific boxes(Called as Folders) When user read data on a hard disk, user start by the ROOT, this is the top directory of the disk. It contains data and directories.
  • 58. Some extensions of DOS file. Text file .txt Command file .com System file .sys Programme file .prg Database file .dbm Library file .lib Batch file .bat Executable file .exe
  • 59. Types of DOS commands Any instruction given to the computer to perform a specific task is called command. The DOS has several commands, each for a particular task and these are stored in DOS directory on the disk. The commands are of two types : (a)Internal Commands : These are in built commands of MS-DOS i.e. these are stored in Command interpreter file (COMMAND.COM). These commands reside in the memory as long as the machine is at the system prompt(C:>) level. To use these commands no extra /external file is required. E.g. DATE, TIME, DIR, VER etc. (b) External commands : These are separate program (.com) files that reside in DOS directory and when executed behave like commands. An external command has predefined syntax. for e.g. HELP, DOSKEY, BACKUP, RESTORE, FORMAT etc. There are also Batch commands or Batch files which are text files that contain a list of internal and/or external commands which are executed in sequence when the batch file is executed. AUTOEXEC.BAT gets executed automatically on booting.
  • 60. In MS-DOS, keyboard shortcuts involving handy ones like Functional keys, arrows, pipe character (” | “), asterisk (*), ?, [] and ESC are of great help for recalling to searching to clearing command line etc., Here are few of them: UP (↑) and DOWN (↓) arrows recall previously entered commands. ESC clears the present command line. It abandons the currently construct command and the next prompt appears. F1 or → retypes one character at a time from the last command entry from the current cursor position. F2 retypes all characters from the last command entry up to the one identical to your next keystroke. It asks you to enter char to copy up to and retypes the last command up to that char. F3 retypes all remaining characters from the last command entry. F4 stores all characters beginning at the first match with your next keystroke and ending with the last command entry. F5 or F8 keys give all the previously typed commands. F6 places a special end-of-file code at the end of the currently open file. Sometimes referred to as Ctrl+z or ^z. F7 key displays command history and ALT+F7/ESC hides it. F9 is used to select a command by number. Just enter the command number and it fetches the command line for you. Pipe character (” | “) combines several series of commands or programs inter-dependent. Name enclosed within [] indicate a sub-directory. Asterisk (*) is used to represent zero or more any characters. ? is used to present zero or single character.
  • 61. DIR Command (Internal) Purpose DIR command is used to displays a list of files and subdirectories in a directory. Syntax DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L]... Example -- 1) C:> DIR D: (display all directories and files of d: drive). 2) Using "A" attribute:- C:> DIR/AD D: (display direcotries (folders) only of d: drive). C:> DIR/A-D D: (display only files of d: drive). C:> DIR/AH D: (display all hidden items of d: drive). 3) C:> DIR/A-D/AR D: (display all files(only) with read only property).
  • 62. Using wild characters: 1) To find all .txt (text) file from d:folder1 C:>DIR D:folder1*.txt ↵ 2) To display all .docx (ms word files) starting with "A" filename. C:>DIR D:folder1A*.docx ↵ 3) To display all files of D: drive starting with "A" but third charcter of file name must be "C" (of any type/extension). C:>DIR D:A?C*.* ↵ 4) To display all files with all extenstions of E:. C:>DIR E:*.* ↵ Switches /A Attribute wise filtering .. R : Read only files. D : Directories only. H : Hidden items only. S : System files only. -D: Files only
  • 63. /B Uses bare format (no heading information or summary). /C Display the thousand separator in file sizes. This is the default. Use /-C to disable display of separator. /D Same as wide but files are list sorted by column. /L Uses lowercase. /N New long list format where filenames are on the far right. /O List by files in sorted order.) S: Size wise sorting. N: Name wise. D: Date wise. E: Extension wise sorting. /P Pauses after each screenful of information. /Q Display the owner of the file. /S Displays files in specified directory and all subdirectories. /T Control what time field displayed or used for sorting timefield C Creation, A Last Access, W Last Written /W Uses wide list format.
  • 64. Date Command (Internal) Purpose This command is used to change or/and display current system date. Example - C:>DATE /t ↵ Mon 11/01/2021 C:>DATE ↵ The current date is: Mon 11/01/2021 Enter the new date: (mm-dd-yy) 11-01-2021 TIME Command (Internal) This command is used to change or/and display current system time. C:>TIME /t ↵ C:>TIME ↵ 02:48 AM The current time is: 2:48:47.32 Enter the new time: 06:10:00
  • 65. CLS Command(Internal) This command is used to clear the screen. Syntax : c:> cls ↵ COPY Command (Internal) Purpose This command is use to copy contents of a file1 to another file2. The first filename you enter is referred to as the source file. The second filename you enter is referred to as the target file. Syntax C:> COPY <Source filename> <Target file name> Example – C:> COPY RV.doc D:>MR.doc ↵
  • 66. COPY CON (Internal) COPY CON command is used to create a file in the existing directory. Here CON is a DOS reserved word which stands for console. C:>COPY CON [file_name] ↵ ……… Your text will goes here.... ^Z (CTRL+Z) OR F6 .. (to save file) XCOPY Command (External) Xcopy command copy directories. Xcopy command copy all files including subdirectories of source directory. Syntax XCOPY Source_Directory Destination_directory Example C:> XCOPY C:RV d:VG ↵
  • 67. EDIT Command (External) EDIT command is used to open DOS Editor to create, display, modify files. Options /B - To open black and white mode. /R - To open file in read only mode. Syntax C:>EDIT [/B|/R] [FILE_PATH] 1. C:>Edit ↵ 2. C:>Edit/B about_us.txt ↵ 3. C:>Edit/R about_us.txt ↵ 4. C:>Edit about_us.txt ↵ Explanation 1: Opens DOS Editor. 2: Opens about_us.txt file in black and white dos editor. 3: Opens about_us.txt file in read only mode. 4: Open about_us.txt file in colored screen.
  • 68. DEL/ERASE Command (Internal) DEL/ERASE command is used to delete one or more than one file at a time. Syntax C:> Del [/Switch] [File Path] Following switches can be use with this command. /P : Display the confirmation message. /F : Force deleting of read only files. /A : Select file to delete based on attributes : S : System files R : read only files H : Hidden files A : ready for archiving C:>DELETE/P D:SB.txt ↵ C:>ERASE/P D:includehelp.txt ↵ D:SB.txt, Delete (Y/N)? Y D:includehelp.txt, Delete (Y/N)? Y
  • 69. REN /(Rename) Command (Internal) This command is used to change the name of any file or directory. Syntax:- C:> REN <Source filename> <Target filename> C:>REN SB.TXT SBAC.TXT ↵ If we get successfully C: that means filename or directory name is get changed. Either it will show the error message. To changing the filename present in floppy disk C:>REN A:SB.TXT SBAC.TXT ↵ Note that you cannot specify a new drive or path for your destination.
  • 70. FORMAT Command (Internal) This command is use to format a specified partition on a hard drive, floppy disk, or flash drive to a specified file system. Syntax format <volume> [/fs:{FAT|FAT32|NTFS}] [/v:<label>] [/q] [/a:<unitsize>] [/c] [/x] [/p:<passes>] format <volume> [/v:<label>] [/q] [/f:<size>] [/p:<passes>] format <volume> [/v:<label>] [/q] [/t:<tracks> /n:<sectors>] [/p:<passes>] format <volume> [/v:<label>] [/q] [/p:<passes>] format <volume> [/q] Example C:> Format D: /q ↵
  • 71. Parameters – /V[:label] Specifies the volume label. /Q Performs a quick format. /F:size Specifies the size of the floppy disk to format (such as 160, 180, 320, 360, 720, 1.2, 1.44, 2.88). /B Allocates space on the formatted disk for system files. /S Copies system files to the formatted disk. /T:tracks Specifies the number of tracks per disk side. /N:sectors Specifies the number of sectors per track. /1 Formats a single side of a floppy disk. /4 Formats a 5.25-inch 360K floppy disk in a high-density drive. /8 Formats eight sectors per track. /C Tests clusters that are currently marked "bad."
  • 72. FIND Command (External) FIND command is used to search for a file based on the contents inside it. (Finds and reports the location of a specific string of text characters in one or more files.) Syntax FIND [/V][/C][/I][/N] string [d:][path]filename[...] Options /V - Displays all lines not containing the specified string. /C - Displays only the count of the number of lines that contained a match in each of the files. /I - Ignores the case of letters in the string search. /N - Displays the found line preceded by the relative line number. Example C:> Find "Awesome" *.txt ↵ (Searches every text document in the current directory for the word “Awesome”.)
  • 73. RESTORE Command (External) Restores to standard disk storage format files previously stored using the BACKUP command. Syntax: RESTORE d: [d:][path]filename [/P][/S][/B:mm-dd-yy] [/A:mm-dd-yy] [/E:hh:mm:ss] [/L:hh:mm:ss] [/M][/N][/D] Options /P The program prompts you before it restores files that have been changed since the last backup or files that are marked read-only. You can choose to continue the restoration of that file or not. /S Backed up files from both the specified source directory and from subdirectories within that directory are transferred to the target path designation. /B Only restores files that were modified on or BEFORE the date you enter. /A Only restores files that were modified on or AFTER the date you enter. /E Only restores files that were modified at or EARLIER than the time you enter.
  • 74. /L Only restores files that were modified at or LATER than the given time. /M Only restores files that have been modified since the last backup. /N Only restores files that no longer exist on the destination disk. /D Displays a list of the files on the backup disk that match the names specified in filename without restoring any files. Even though no files are being restored, you must specify the drive to which backed-up files will be restored when you use /D. Examples C:> restore b: c:*.* /S ↵ To restore all the files from drive B to the root directory of drive C (and all subdirectories within it) C:> restore a: c:fileannual86 ↵ To restore the file ANNUAL86 from the backup disk in drive A to the FILES directory on drive C
  • 75. PROMPT Command (Internal) This command Changes the DOS command prompt. Syntax PROMPT [prompt text] [options] DOS PROMPT Characters $b | $d system date $e esc char $g > $h destructive bk space $i < $n default drive $p full path description $q = $t system time $v DOS version no $_ CR and LF $$ the $ sign Example C:> PROMPT $$ ↵ This command displays $ as new prompt.
  • 76. PATH Command (Internal) Purpose: Sets or displays directories that will be searched for programs not in the current directory. Syntax: PATH; PATH [d:]path[;][d:]path[...] Example: C:>path c:program ↵ To tell DOS to search for external DOS commands and other executable programs in the PROGRAM directory that is within the root directory on drive C, enter C:> path program;filessales;data2 You can tell DOS to search more than one path by specifying several pathnames separated by semicolons.
  • 77. MORE Command (External) Purpose: Sends output to console, one screen at a time. Syntax: MORE < (filename or command) (name)|MORE Example: C:>more < sale2.txt ↵ To display the file SALE2.TXT, one screen full of data at a time C:>TYPE (filename)|MORE ↵ To display the output of the TYPE command one screen at a time, you can enter the command using the following format: C:>type b:letterslet3.doc|more ↵ For example, to display the file LET3.DOC in the LETTERS directory on drive B,
  • 78. TYPE Command (Internal) Purpose Displays the contents of a file. Syntax TYPE [d:][path]filename Example C:> type b:letter3.txt ↵ (To display the contents of the file LETTER3.TXT on drive B) VER Command (Internal) Displays the DOS version number. C:> VER ↵
  • 79. VOL Command (Internal) Displays a disk`s volume label. C:> vol d: ↵ To display the volume label for the disk in drive D ↵ CHKDSK Command (External) Checks a disk and provides a file and memory status report. Syntax CHKDSK [d:][path][filename] [/F][/V] Example C:> chkdsk d: ↵ This will analyze the disk in drive D: and report a status message.
  • 80. DISKCOMP Command (External) Compares the contents of two diskettes. Syntax C:> DISKCOMP [d:] [d:][/1][/8] Example C:> Diskcomp a: b: /1 ↵ (Compares the first side of A: with B:) C:> Diskcomp a: b: /8 ↵ (Compares the first 8 sectors per track.)
  • 81. TREE Command (External) Displays directory paths and (optionally) files in each subdirectory. Syntax TREE [Drive:[[Path] [/F] [/A] /A - Specifies that alternative characters (plus signs, hyphens, and vertical bars) be used to draw the tree diagram so that it can be printed by printers that don`t support the line-drawing and box-drawing characters. /F - Displays the names of the files found within each directory listed. Example C:> tree /F ↵ SYS Command (External) Transfers the operating system files to another disk. The three files that are transferred are IO.SYS, MSDOS.SYS, and COMMAND.COM C:> SYS D: ↵
  • 82. MEM Command (External) Displays the amount of installed and available memory, including extended, expanded, and upper memory. C:> Mem ↵ http://www.rcppmail.org/DOS/internal_commands.htm#COPY%20CON
  • 83. Directory related commands MKDIR / MD Command (Internal) This command allows to create a new directory. Syntax C:> MD <Dirname> Example C:> MKDIR RV ↵ C:> MD D:RT RV ↵ CD.. / CHDIR Command (Internal) This command is use to change the current working directory.
  • 84. RM / RMDIR Command (Internal) This command is use to removes directories that are empty. (Any directories deleted with the rmdir command cannot be recovered. Be very careful where and how you use this command.) Example C:> RD C:newfiles ↵ To remove the directory NEWFILES from drive C C:> RD C:newfilessales ↵ To remove the directory SALES that is within the NEWFILES directory on drive C PRINT Command (External) This command prints the data file.
  • 85. External commands: - This commands are not permanent part of the memory. To execute or run this commands an external file is required. Example : [.] Dot exe, bat. Some commonly used DOS external commands are . 1. CHKDSK:- The command CHkDsK returns the configuration status of the selected disk. It returns the information about the volume, serial number, total disk space, space in directories, space in each allocation unit, total memory and free memory. Syntax : - C : / > CHKDSK drive name Eg:- C : / > CHKDSK e : If drive name is not mentioned by default current drive is considered.
  • 86. 2. Diskcopy : - Disk copy command is used to make duplicate copy of the disk like Xerox copy. It first formats the target disk and then copies the files by collection. From the source disk and copied to the target disk. Syntax : - C : / > disk copy < source path > < destination path > Ex: - c : / > diskcopy A : B : 3. Format : - Format is used to erase information off of a computer diskette or fixed drive. Syntax : - C : / > format drive name Ex : C : / > format A: 4. Label : This command is used to see volume label and to change volume label. Syntax : C : / > label drive name Ex : C : / > label A:
  • 87. 5. Scandisk : - This utility is used to repair and check various disk errors. It also defects various physical disk errors and surface errors. Syntax : - C : / > scandisk < drive names > C : / > Scandisk A : 6. Move : The purpose of move is move to files from one place to another place. Syntax: C : / > Move < source path > < target path > 7. Print : This command allowed users to print a text file to a line printer. Syntax : C : / > Print < files name > C : / > print Ramesh 8. Tree : This command displays the list of directories and files on specified path using graphical display. It displays directories of files like a tree. Syntax:- C : / > tree > path C : / > tree A:
  • 88. 9. Deltree: This command is used to delete files a directories same as by the del and RD commands. This command is more useful than del and RD commands because it completely removes specified directories ie., disk with all it files and sub – directories at a time. Syntax:- C:/> deltree (path) C:/> deltree A:/>ram 10. Sort: this command is used for sorting data and displaying the result on the screen: Syntax: C:>dir/sort/r (reverse order) 11. Sys: this command transfers MSDOS System files to specified areas to make the disk bootable; Syntax: C:>Sys A: 12. Pipes (|) it connects two files ie the standard output of one filter command becomes standard input of another filter; eg Dir/Sort/ more ||
  • 89. WildCard Characters - A wildcard character is a special character that represents one or more other characters. The most commonly used wildcard characters are the asterisk (*), which typically represents zero or more characters in a string of characters, and the question mark (?), which typically represents any one character. For example, in searching: run* would mean "any word that starts with 'run' and has any kind of ending." If you entered "run*" at a search engine that offered a wildcard character capability, you would get results for run, runs, running, runner, runners - in short, any possible word that might begin with the three letters. Wildcard characters are used in regular expressions (a form of programming in which input data is modified based on specified patterns) and in searching through file directories for similar file names (for example, if all the work files on a project start with the characters "P5," you could easily locate all the project files by simply searching for "P5*"). A wildcard character is a type of meta character . In various games of playing cards, a wild card is a designated card in the deck of cards (for example, the two of spades) that can be used as though it were any possible card.
  • 90. Alternatively referred to as a wild character or wildcard character, a wildcard is a symbol used to replace or represent one or more characters. The most common wildcards are the asterisk (*), which represents one or more characters and question mark (?) that represents a single character. MS-DOS and Windows command line wildcard examples C:> dir c?mp List files in MS-DOS using the dir command that contain c, mp, and any other character in-between. For example, comp, camp, c2mp, and c-mp would all be matched. C:> dir *.mp3 In this next example, the dir command would only list files that end with .MP3 file extension. C:> dir *data List any file that ends with data using the dir command. For example, the files "appdata," "mydata," and "123data" would all be matched.
  • 91. dir he??.* List any file that is four characters long, begins with he, and has any extension. For example, help.txt, help.mp3, and heck.jpg would all be matched. rename *.txt *.jpg Rename all files in the current directory that end with the file extension .txt to .jpg. For example, the file test.txt would become test.jpg. del comp*.txt Deleting files in MS-DOS that begin with comp and end with a ".txt" extension.
  • 92. The autoexec.bat and the config.sys were files created for MS-DOS to load device and operating system files to properly run. These files are required for later revisions of MS-DOS to load. A batch file is a file that contains a sequence of commands for a computer operating system. It's called a batch file because it batches (bundles or packages) into a single file a set of commands that would otherwise have to be presented to the system interactively from a keyboard one at a time. A batch file is usually created for command sequences for which a user has a repeated need. Commonly needed batch files are often delivered as part of an operating system. You initiate the sequence of commands in the batch file by simply entering the name of the batch file on a command line. Using batch files With batch files, which are also called batch programs or scripts, you can simplify routine or repetitive tasks. A batch file is an unformatted text file that contains one or more commands and has a .bat or .cmd file name extension. When you type the file name at the command prompt, Cmd.exe runs the commands sequentially as they appear in the file. You can include any command in a batch file. Certain commands, such as for, goto, and if, enable you to do conditional processing of the commands in the batch file. For example, the if command carries out a command based on the results of a condition. Other commands allow you to control input and output and call other
  • 93. The standard error codes that most applications return are 0 if no error occurred and 1 (or higher value) if an error occurred. Please refer to your application help documentation to determine the meaning of specific error codes. https://www.ionos.com/digitalguide/server/tools/creating-a-batch-file/ https://www.computerhope.com/issues/ch001666.htm https://searchwindowsserver.techtarget.com/tip/Creating-batch-files-using-the- DOS-Copy-Con-command https://www.tutorialspoint.com/batch_script/batch_script_quick_guide.htm http://www.hermit.cc/it/dos/batfile.htm
  • 94. CONFIG.SYS is a text file containing DOS (Disk Operating System) commands that tell the operating system how the computer is initially set up. More specifically, CONFIG.SYS commands specify memory device drivers and programs that control hardware devices; enable or disable system features; and set limits on system resources. CONFIG.SYS loads at startup before the autoexec.bat (automatic execute.batch program) file. Because CONFIG.SYS is a text file, it is editable in any text-editing program. The CONFIG.SYS file is read every time a DOS system is booted. The system then reads that file and executes the command following it. Users can easily make changes as per their requirements by simply saving changes in the CONFIG.SYS file. Since it is a text file, it can be edited it in any editing program. This file is located in the root directory of the drive; this is the same location from where system is booted. The most common commands in the CONFIG.SYS file include: BUFFERS= This command is used to specify the buffer size. FILES= This command is used to determine the number of files that a user can open simultaneously.
  • 95. BREAK ON / OFF Command (Internal) Used from the DOS prompt or in a batch file or in the CONFIG.SYS file to set (or display) whether or not DOS checks for a Ctrl + Break key combination. Discussion DOS normally detects a press of the Ctrl + Break or Ctrl + C key combination only while checking for keyboard input or while sending characters to the screen. Some application programs automatically reset BREAK (either ON or OFF); this will cancel the BREAK options you set. Syntax Enter break on to tell DOS to check for the Ctrl + C key combination. To determine the current BREAK setting, enter break
  • 96. BUFFER Command (Internal) Used in the CONFIG.SYS file to set the number of disk buffers (a number from 1 to 99) that will be available for use during data input. Also used to set a value for the number of sectors to be read in advance (read-ahead) during data input operations. Discussion While conducting input and output operations, DOS stores information in memory buffers so that it will be readily available when requested by an application. The more buffers set in the CONFIG.SYS file with the BUFFERS command, the faster DOS will be able to access the information requested. You should experiment to determine the most efficient number of buffers for your computer and the applications you are running. The same is true for determining the appropriate number of read-ahead buffers. The read ahead buffers determine the amount of data DOS will read from the disk in addition to the data requested by the application. Syntax BUFFERS=(number),(read-ahead number) break on buffers=20,2 To set buffers to 20 and read-ahead buffers to 2 enter the above line in your CONFIG.SYS file
  • 97. FILES Command (Internal) Used in the CONFIG.SYS file to specify the maximum number of files that can be open at the same time. Discussion You should specify a FILES= value of at least 20 to satisfy most of today`s application programs. Some programs, such as Windows, may require as many as 30 or 40 files. If you have not allocated enough files for an application, an error message may be displayed. If this happens, increase the number of files available and restart your computer. You should be aware that some programs change the FILES= value in your CONFIG.SYS file automatically. After installing a new program, be sure to check your CONFIG.SYS file to make sure the setting will work with your other applications. Syntax FILES=(number) files=40 To set the maximum number of files that can be open at the same time to 40, enter the above in your CONFIG.SYS file:
  • 98. SHELL Command (Internal) Used in the CONFIG.SYS file to specify the command interpreter that DOS should use. Discussion In most cases DOS will use the command interpreter COMMAND.COM. If you are using another command interpreter, or if DOS is not in the root directory, you can use the SHELL command to tell DOS the name and location of the other command interpreter. Syntax SHELL=[d:][path]filename [parameters] shell=c:altdosndos.com To use a command interpreter called NDOS.COM, located in the ALTDOS directory, enter the above line in your CONFIG.SYS file:
  • 99. ECHO Command (Internal) Purpose: Turns on or off the display of commands in a batch file. Can also be used to display a message in a batch file. Discussion Normally, commands in a batch file are displayed as the batch file runs. ECHO OFF turns off this feature. ECHO ON turns the display feature back on. If you enter the ECHO command with no options , the program will display the current ECHO setting. Syntax: ECHO on|off ECHO (message) echo off echo This is file one If you want to display the message This is file one during the execution of a batch file, but you do not want to display the commands being acted upon, enter
  • 100. PAUSE Command (Internal) Suspends execution of a batch file until a key is pressed. PAUSE suspends execution of the batch file and displays the message Strike a key when ready ... pause Insert the target diskette in drive A To suspend execution of a batch file and display the message Insert the target diskette in drive A, enter
  • 101. CALL command (Internal) Calls another batch file and then returns to the current batch file to continue processing. Syntax: CALL [d:][path]batchfilename [options ] Used within a batch file to specify the name of another batch file (a file with the .BAT filename extension). The original batch file calls into action the CALLed batch file. When the CALLed batch file ends, control is transferred back to the original batch file. call starter call tester call finish To run the files STARTER.BAT, TESTER.BAT, and FINISH.BAT in sequence, enter the above three lines in your batch file:
  • 102. IF Command (Internal) Allows for conditional operations in batch processing. Syntax: IF [NOT] EXIST filename (command) [parameters] IF [NOT] (string1)==(string2) (command) [parameters] IF [NOT] ERRORLEVEL (number) (command) [parameters]
  • 103. Discussion When used in combination with the GOTO command, the IF command provides a way to transfer control within a batch file dependent on the outcome of a test. For more information on IF and other batch commands. The IF test is indicated by the condition label in the command format. It can be one of three types: Condition 1: IF [NOT] EXIST (filename) (command) This condition is determined by a test to see if a file exists (or does not exist) on disk. When this conditional test is included (it can be on any line of your batch file), DOS checks to determine if the specified file exists (you must specify the path so DOS can find the file). If the condition is true (as stated), the specified command is executed. If the condition is found to be false, the command is not acted on and processing proceeds to the next line in the batch file.
  • 104. When the IF command is used together with the GOTO command, it provides a way to transfer control to a different line in the batch file dependent on the outcome of the test. For example, to display a warning message only if the file DATA.1 does not exist in the current directory, enter echo off if not exist data.1 goto MESSAGE echo The file DATA.1 exists on the current directory goto END MESSAGE echo The file DATA.1 was not found. echo The file must be in the current directory :END
  • 105. When you enter the name of this batch file, there are two possible outcomes. If the file DOES NOT EXIST in the current directory, the program will display: echo off The file DATA.1 was not found. The file must be on the current directory If the file DOES EXIST in the current directory, the program will display: echo off echo The file DATA.1 exists on the current directory. In this example, the IF command is combined with the GOTO command to determine the optional branching. The command tells DOS to check the current disk to determine if the file DATA.1 exists. Since we are using the NOT EXIST form of the command, the condition is true if it DOES NOT find the file; since the condition is true, the specified command (in this case, the GOTO command) is acted on. The GOTO MESSAGE line passes processing to the :MESSAGE label and the messages on the following lines are displayed.
  • 106. Condition 2: IF [NOT] string1==string2 (command) This operation checks to determine if the first string you enter is equal (or is NOT equal) to the second string you enter. If the condition is true (as stated), the specified command will be carried out. DOS judges this condition based on whether or not the two strings are EXACTLY identical. DOS WILL detect a difference between uppercase and lowercase letters. You can create a very useful version of the IF command that checks to determine whether or not a parameter was passed to the batch file from the command line.
  • 107. The following batch file acts conditionally depending on a test of whether or not any characters were entered on the command line after the batch file name. echo off if not x==%1x goto PRINT echo You must enter a parameter immediately after batch file name goto END :PRINT echo The passed parameter is [ %1 ] :END The first line of this batch file checks to determine whether or not a parameter has been passed at the command line. It uses the IF command to determine if string one (the character `x`) is equal to string two (the character `x` plus the %1 symbol that represents the first passed parameter). If a parameter WAS passed to the batch file, the two strings will not match and the condition, (stated as NOT equal) is true; the GOTO command will be acted on, transferring processing to the label :PRINT.
  • 108. If the condition is found to be false (the two strings ARE equal), it means a parameter WAS NOT entered on the command line. In that case, the GOTO command on the same line as the IF command will not be acted on and processing will be transferred to the next line of the batch file. The next line includes the message You must enter a parameter immediately after the batch file name. The following line transfers the processing to the :END label and the program terminates. If characters WERE entered after the batch filename, the program will display echo off The passed parameter is [ test ] If characters WERE NOT entered after the batch filename, the program will display echo off You must enter a parameter immediately after batch file name
  • 109. Condition 3: IF [NOT] ERRORLEVEL (number) (command) This operation checks to determine if an ERRORLEVEL number is set (or is NOT set) at or greater than the specified value. The ERRORLEVEL number is set by programs and the value is retained in the computer`s memory. This command is used to check that value. DOS judges this condition to be true if the ERRORLEVEL code is equal to OR GREATER than the number you specify. A common use of the IF command is to display a message to indicate that an ERRORLEVEL has been set. To display a message whenever any ERRORLEVEL number has been set (any value above zero), enter: echo off if errorlevel 1 echo The errorlevel is now greater than zero When this line is acted on (and if the ERRORLEVEL is found to be set to a value), the ECHO command will be acted on and the program will display echo off The errorlevel is now greater than zero If DOS does not find a value set for ERRORLEVEL, the program terminates without displaying the message.
  • 110. GOTO Command (Internal) Purpose: Causes unconditional branch to the specified label. Syntax: GOTO (label) Discussion Sends the program to the command found in the line immediately after the label definition. A label is the first eight characters on a batch file line after a colon. The label can be indented, as long as there are only spaces preceding it on that line. The label (the string of eight characters) can include spaces but not other restricted characters such as commas, semicolons, or equal signs. A label name after a GOTO command transfers processing to the line containing the label. If a label is not found (or if the label contains illegal characters), an error message is displayed and the batch file terminates. :START echo This is an infinite loop goto START To create a batch file that will function as an infinite loop displaying the message This is an
  • 111. D
  • 112. D
  • 113. D
  • 114. D
  • 115. D
  • 117. D