0 ratings0% found this document useful (0 votes) 137 views37 pagesIntroduction To Operating System
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
= }—
INTRODUCTION TO
OPERATING SYSTEM __
ER] OPERATING SYSTEM-DEFINITION
An operating system is a program that acts as an interface between the user of a
computer and the computer hardware. The purpose of operating system is to provide an
can execute programs in a convenient and efficient manner.
environment in which a use
Operating system is a first program that gets loaded into the memory through a process
called booting.
Operating system is a control program that controls the execution of user Programs to
prevent errors and improper usage of the computer.
Thus, operating system is an integrated set of programs that manages the various
hardware resources such as processors, memory, I/O devices, communication devices
and the overall operations of a computer system and provides services to users’
programs,
Its primary objective is to improve the performance and efficiency of a computer system
and make it user friendly. Thus, like a manager of a company, an operating system is
responsible for smooth and efficient operation of the entire computer system.
The most common operating systems are the windows family of operating system
(Windows 98, Windows 2000, NT, Vista and Windows 7), UNIX and Macintosh
Operating system.
1.1 Operating System as an Extended Machine
* Anoperating system is a layer of software on the top of the bare hardware of a computer
system.Introduction to Operating B
© This operating system manages all parts of the system, and presents to the user wig
interface or virtual machine, that is easier to program and use. *
It means, that the operating system hides the details of the hardware resources fron,
programmer and provides the programmer with a convenient interface for Using ¢
computer system. This is called abstraction.
‘Thus, the abstraction feature of operating system hides the lower level details from y,.
and provides a set of higher level function to users.
The operating system acts as an intermediary between the hardware and its yy.
providing a high level interface to low level resources, and making it easier for ,
programmer and other users to access and use those resources.
user 1 user 2 user 3 usern
Database |
Assembler system
‘System and Application programs
(i
Operating System
a Fig. 1.1 (Logical Architecture of a Computer Syste )
-1 shows the logi i ;
a acne of computer system. The hard
7 eH ie rdware rest
other system Softwares such as i Cae ‘ayer which in tum is su < i
pplication Programs compilers, editors, assemblers, | = oe es
; , loaders etc. and by 4
5 ment and educati, sing applications, scientifj : i :
Finally, the end lucation Een
i applicatic
Users view th ions etc,
by the pplication Programs, '¢ Computer system in term: a
* Thus, the Purpose of 7 's of the user interfaces p!
the operati
Machi; ING system j
chine or Virtual ese to Present the user with the equivalent
at is easier to program than the undet!”=
introduction to Operating System =
4.4.2 Operating System Resource Manager
, + A computer system usually has many hardware and software resources such as
processor, memory, disks, printers, I/O devices etc. The operating, system acts as »
manager of these resources,
¢ The operating system is responsible for controlling and allocating various hardware and
software resources to different users in an optimal and efficient manner.
«The task of resource management becomes essential in multi-user operating systems
where different users compete for the same resources.
* Asaresource manager, an operating system keeps track of :
1. Who is using which resource
2. Granting resource requests
3. Accounting resource usage
4, Mediating conflicting requests from different programs and users.
© Operating system manages resources in two ways :
1. Time Multiplexing, It defines the sharing of resources on the basis of fixed time
slices. For example, the operating system allocates the resources, such as CPU to
program A for a fixed time slice. After that time slice is over, the CPU is allocated
to another program B and so on.
Another example of time multiplexing is sharing of a single printer. When
different users submit their print jobs they are queued up and are processed in
time dependent fashion.
2. Space Multiplexing. It defines the concurrent sharing of resources among
different programs. For example, sharing of hard disk and main memory is space
multiplexing.
FUNCTIONS OF OPERATING SYSTEM
| ‘The primary function of an operating system is to provide an environment for the execution
of users’ program.
The various functions of operating system are :
1, Process Management
2. Main Memory Management
t 3. Secondary storage Management
{ 4. File Management
5. I/O Management
a ...= Introduction to Operating at
6. Protection and Security
7. Networking
8 Command Interpretation
1. Process Management i
* The process management refers to the assignment of pene t erent oe
performed by the computer system. The process managemen Vatio,
Processes of a system for execution.
* The operating system is responsible for the following activities in connection wi,
Process management :
- Creating and deleting both user and system processes.
Suspending and resuming processes.
Providing mechanisms for process synchronization such as semaphores,
eR
Providing mechanisms for process communication (i, communication betwen
different processes in a system)
”
Providing mechanisms for deadlock handling. Deadlock is a condition in which te
‘number of processes wait infinitely for some shared resource,
also checks the status of processes,
2 Job Scheduler. I selects the job from job queue (that are ready to execute).
5. Process Scheduler. It selects a proces
: s that is to be executed amongst the various
Processes in cast of multiprogrammin
ig.
4 Dispatcher. Iti responsible for phys; i
Physical allocation of processor to that has
been selected by process scheduler een
2. Main Memory Management
* Memory is organized as a
large arra; of rams
andintructions for execution, 48 OF bytes that stores the SSE
The main memory j
managers idee tame. 4 hared by 08 and “pplication programs, The memotl
of main m ‘ - i
Programs reside emory where OS Tesides and where application
.
* In multi-programmi i
ends LC 708 mming fnvironment, several Programs or pr, in mai
FY 80 a8 to increase the Cpy Utilization are Processes are kept in mé
€crease the Cpy Tesponse time.oa
-
\
a
Introduction to Operating System
a
‘The memory manager also implements various protection techniques in order to protect
the allocated memory from unauthorized access.
In such a situation, where several programs reside in the main memory at the same time,
memory management is important. Different algorithms are possible for selecting a
memory management scheme.
The operating system is responsible for the following activities in connection with
memory management:
1. Keeping track of which locations of memory are
process and which locations of memory are free or unallocated.
ses are to be loaded into memory when memory space
currently being used and by which
2. Deciding which proces
becomes available & how much memory is to be illocated.
3. Allocating and deallocating memory spaces as needed.
3. Secondary Storage Management
‘The main memory has a limited size and cannot store all the user programs at once-
Moreover, when the power is lost, the data it holds are also lost. So computer system
provides secondary storage devices such as magnetic disks and tapes to back up main
memory.
The secondary storage devices store system programs,
assembler and user programs that are not used frequently.
such as compiler, editor and
‘The operating system performs following functions in connection with disk
management:
1. Free space manager
used objects.
2. Storage allocation ie, allocates storage area for storing new programs.
ment ie., manages free space on disk by reclaiming memory from
3. Disk scheduling.
4. File Management
File is a storage unit and is a collection of information.
Files are categorized on the basis of information stored in it such as data file, source file
and object file.
Data files represent the information in numeric, alphabetic or alphanumeric mode.
Source files stores the code for programs and the object files are built on compiling the
programs.BZ
im Introduction to Operating Syay,,
i d CD.
«Files are stored onto storage devices, such as hard disk, floppy any ;
° re .r into directories for user's ease.
File are grouped together into directories a
© The operating s .ctions in connection with file m
perating system performs following fun: i i anagement
1. Creating and deleting files.
2. Creating and deleting directories. oe » ‘
3. Providing operations for manipulating files and directories such as read, wrt,
execute, copy, append etc. ;
4. Mapping the files onto secondary storage devices such as disk.
5. Backing up files on stable (non-volatile) storage media so that they can be restored if
original file is lost.
5. Input/Output Management
© 1/0 devices attached to the computer system are used to enter the data into the system
and get the output.
This subsystem manages all the I/O devices and contains a variety of software programs
to handle these devices.
This subsystem contains a collection of device drivers. A device driver is a software
module that manages the communication and controls the specific I/O device. Device
driver converts the logical requests from the user into specific commands directed to the
device itself.
* This subsystem also implements device allocation policies. For each device, I/O device
management subsystem, keeps an account to determine which device is allocated to
which process. It also looks after the allocation of devices to processes and reclaims them
when processes do not need them.
* The method of deciding how devices are allocated depends upon the flexibi ity of the
device. Some devices cannot be shared (e.g. card readers) and must be dedicated to
Process. Other devices such as disks are shared; hence are more flexible.
* The I/O subsystem also implements a data cache to temporarily hold the device conten's
for improving their access speed,
* Thus, device management subsystem performs following, tasks :
1. Keep track of resources (devices, channels, control units). This component of /
subsystems is called 1/0 traffic controller,
2 Allocates the resource (device) in an efficient manner. If itis to be shared, thes
decides who gets it and how much. The handling of this task is called I/O scheduling:————
Introduction to Operating System i 17 |
3. Allocates the resource (device) and initiates the I/O operation.
4, Reclaim the resource. However, in most cases the I/O terminates automatically.
6. Protection and Security
Another important function of an operating system is to protect itself from the user
processes and to protect different users processes from one another in a system.
In a multiprogramming environment, where several users processes reside in main
memory at the same time, they may interfere with OS or with each other.
Thus, protection mechanism controls the access of users, programs and processes used
by various applications.
Protection mechanisms are also used to provide protection to various resources such as
memory segments, files and CPU against unauthorized users.
Security deals with protecting the various resources and information of a computer
system against destruction and unauthorized access.
A total approach to computer security involves both external and internal security.
External security deals with securing the computer system against external factors such as
fires, floods, earthquakes, stolen disks/tapes, leaking out of stored information by a
person who has access to the information.
Internal security deals with users authentication, access control and cryptography.
7. Networking
Networking is used for exchanging information among different computer that are
distributed across various locations.
Distributed systems consist of multiple processors and each processor has its own
memory and clock.
‘The various processors communicate using communication links, such as telephone lines
or buses, Bus is a collection of wires that runs parallel across the width of motherboard.
‘The processors in distributed system vary is size and function. They may include small
microprocessors, workstations, minicomputers and, large general purpose computer
systems.
‘Thus, a distributed system enables us to share the various resources of the network.
This results in computation speedup, increased functionality, increased data availability
and better reliability.a
cE)
8. Command Interpretation
Introduction 19 Operating
* The command interpreter is the basic interface between the computer and the user
* Command interpreter provides a set of commands using which the user can »
instruction to the computer for getting some job done by it.
* The various commands supported by command interpretation module are known
system calls.
© When a user gives instructions to the computer by using these system cals,
command interpreter takes care of interpreting these commands and directing 1,
system resources to handle the requests.
Hence a command interpreter provides a user interface to hide the hardware details «
the system from the user.
‘There are two different user interfaces supported by various operating systems:
1. Command line interface
2. Graphical user interface
1. Command Line Interface (CLD. It is the textual user interface in which user give
instruction to computer by typing the commands.
2. Graphical User Interface (GUI). GUI provides the user a screen full of graphic!
icons or menus and allows the user to make a rapid selection from the displayed
icons or menus to give instruction to computer.
OPERATING SYSTEM SERVICES
As discussed earlier, the main purpose of operating system is to provide environment for
execution of programs. Thus, an operating system provides certain services to programs and te
users of those programs.
However, different operating systems can provide different set of services, Some of the base
services provided by operating system are:
1. Program Execution
© Operating system provides a convenient environment where users can run thé!
programs.
The operating system performs memory allocation to programs, load them in?
appropriate location so that they can execute. The users need not to worry about all he
tasks.
sntroe
2.V
ie eerh
-
Introduction to Operating System 1.9
2. VO Operations
« Inorder to execute a program, it usually requires an I/O operations. For example, it may
need to read a file and print the output.
* When all these I/O operations are performed users cannot control I/O devices.
* All /O are performed under the control of operating system.
3. File System Manipulation
© The execution of a program may involve reading data from a file or writing data to a file.
It may also require to create or delete a certain file.
‘© The operating system provides all these operations and performs secondary storage
management.
‘© The users just give commands to read or write a particular file, the rest of work is done
by an operating system.
4, Communication
© The various processes executing on a system may need to communicate in order to
exchange data or information.
© Operating system provides this communication by using a facility of message passing. In
message passing packets of information are moved between processes by the operating
system.
5. Error Detection
¢ When various programs are executing on a system involving various resources, an error
may occur.
© Error may occur in CPU and memory hardware (such as a memory error or a power
failure), in /O devices and in user programs (such as stack overflow, an attempt to
access an illegal memory location.)
© Insuch a situation, the operating system constantly monitors the system for detecting the
errors.
+ For each type of error, the operating system takes the appropriate action to ensure
correct and consistent computing.
6. Resource Allocation
«© When multiple processes are running on a system or multiple users are logged on, large
variety of resources may be used by each process or a user.hem or
* These resources may be CPU cycles, main memory, files, /O devices ete.
* The operating system manages all these resources and uses different algorithm,
satisfy the requirements of different processes or users.
7. Accounting
* When multiple resources are allocated to different processes in multiprogramming. te
operating system keeps track of which user or process has how many resources and y
which kind.
* This kind of record keeping by an OS is known as accounting.
8. Protection
* When several processes are executing concurrently, it is important that differen;
Processes should not interfere with each other. Moreover, these processes should ni
also interfere with operating system.
Thus, an operating system provides protection to ensure that all the access to system
resources is controlled.
An operating system also provides security to the system by authenticating different
users by means of passwords, artifacts or biometrics. Only the authorized users a
allowed to access the system.
The operating system also defends the external I/O devices, including modems and
network adapters from invalid access attempts.
ERI CLASSIFICATION OF OPERATING SYSTEMS
The Operating systems may be classified into different types depending upon the nature of
interaction between the user and his/her program.
The various types of operating system are:
1.
7
3.
4.
5.
6.
7.
8.
9.
Single user operating system
. Multi user operating system
. Simple Batch Processing operating system
. Multiprogramming operating system
Multitasking operating system
. Parallel or multiprocessing operating system
. Timesharing operating system
Distributed operating system
Real time operating system
ee=_—_—_—
Introduction to Operating System en
1.4.1 Single User System
«In single user operating system, a single user can access the computer at a particular
time.
+ The computer, that are based on this operating system, have only single processor and
execute only a single program at all the time.
* This system provides all the resources such as CPU, I/O devices to a single user at all the
time.
* Single user operating system is of two types:
1, Single user, single-tasking operating system
2. Single user, multi-tasking operating system
«The Single User, Single-tasking operating system allows a single user to execute one
program at a particular time. For example MS-DOS and Palm OS for Palm handheld
computers are single user, single tasking OS.
© The Single User, Multi tasking operating system allows a single user to execute
multiple programs at a same time. For example, a user can perform different tasks such
as making calculations in Excel sheet, printing a word document and download a file
from the internet at the same time.
«Figure 1.2 shows the working of single user operating system.
© The main disadvantage of this operating system is that CPU sits idle for most of the time
and is not utilized to its maximum.
Fig. 1.2 (Single user operating system)
1.4.2 Multi-User System
* In a multi-user operating system, multiple numbers of users can access different
resources of a computer at a same time.
* The access is provided using a network that consists of various personal computers
attached to a mainframe computer system (see figure 1.3)Introduction to Operating om
Personal
Computer
8 Network
Mainframe
Computer Personal one
Computer Compasses
Fig. 1.3 (Multi-user operating system)
The various personal computers can send and receive information to mainframe
computer system.
Thus, the mainframe computer acts as the server and other Personal computers act s
clients for that server.
The examples of multi-user OS are UNIX, Windows 2000, Novell Netware
Figure 1.3 shows the working of multi-user OS.
Advantage of Multi-user System
1. Ithelps in the sharing of data and information among different users.
2. Italso helps in the sharing of hardware Tesources such as printers and modems.
Disadvantages of Multi-user System
1. Itrequires expensive hardware to setup a mainframe computer.
2. When multiple users log on or work on
Same system it reduces the overall perforant
of system,
1.4.3 Batch Processing System
Batch processing is one of the oldest method of run;
‘ing the programs,
The computers in the Past were vei
The users did not interact directly with computer system,Introduction to Operating System
.
The users prepare their job that consisted of the program, data and some control
information. This job was usually in form of punched cards.
The users submit their job to a computer operator. When a batch of programs has been
collected, the operator loads this batch of programs into the computer at one time where
they are executed one after the other.
Finally, the operator retrieves the output of these jobs and returns them to the concerned
users.
In this way many different jobs are processed, one after the other without any interaction
from the users during program execution.
In such a batch processing system, the various jobs of the users are collected in a queue.
This process is known as spooling. Spooling is a short form of Simultaneous Peripheral
Operations OnLine.
Spooling refers to putting jobs in a buffer (an area in a memory or disk) Such a data can
be output to printer and other devices. Spooling is useful when device access data at
different rates. In such a case buffer provides an area where data can rest until a slow
device is ready to receive that data.
The method of batch processing reduces the idle time of computer system because
transition from one job to another does not require operator intervention.
The batch processing operating system was called a monitor that resides in the main
memory (see figure 1.4). Such a portion of main memory is known as resident monitor.
The batch monitor executes batches of job at definite interval of time.
The batch monitor accepts the commands for initializing, processing and terminating a
batch.
The monitor reads in the jobs one at a time from the input devices (typically a card
reader or magnetic tape drive).
As the job is read in, the current job is placed in the user program area, and control is
passed to this job. When the job is completed, it returns control to the monitor that
immediately reads in the next job.
The batch monitor executes the batches on the process of job scheduling that sequences
different jobs on first come first served (FCFS) basis.
Thus, the purpose of monitor is to automatically transfer the control from one program
to another in a batch.
Such an operating system also provides the provision to set the priorities for different
batch and the highest priority job is executed before other batches,
The process scheduling, memory management, file management and /O management
functions are quite simple in batch processing system.Fig. 1.4 (Memory layout for resident. monitor)
* Process Scheduling (ie. allocation strategy for a process to a Processor is typically in
order of their arrival i. First Come First Served (FCFS) basis,
* Memory Management is done by dividing the memory into two areas. One portion o
Partition is occupied by resident monitor and the other Portion is dynamically used to
load the transient programs for execution. The memory space vacated by one program
upon its completion is then allocated to other transient program.
* VO Management. Since only one program is executed at a time, there is no contention
for 1/0 devices. Thus the allocation and de-allocation
* Fille Manageiment. Access to the files is done on se
access the files at a particular time, so there is h
or concurrency control mechanisms,
* Figure 1.5 shows the working of a batch Processing operating system.
rial basis. Also, only one program
‘ardly any need to provide access control
Advantage of Batch Processing
1. Batch processing is particularly useful for o,
2. Increased performance as it was possible fo
finished without any manual intervention,
3. Priorities can be set for different batches.
job to start as soon as previous job i§
Disadvantages of Batch Processing
1. No interaction is possible with the user while the Program is being executed. Users
iLSS
snroauetion to operating System
i creating inflexible
have no control over intermediate result of a program. This results in creating
software.
te dat
2. It reduces timeliness in some cases. The time required to accumula! rate
in some cases, destroy much of the value of the data. The information that r
‘a into batches,
eventual processing is no longer timely.
Batch
[= }———+
Monitor
=
=
yen
Fig. 1.5 (Batch Processing Operating System)
The batch processing operating system has high turnaround time. Turnaround time is
the time taken between the submitting the job and getting the output, which includes
the batch formation and its execution.
In batch processing, it is difficult to provide the desired priority scheduling. For
example, if two high priority jobs were to be run but were in separate batches, one
would have to wait until the other's batch was completely processed.
- Only single user process is a sole occupant of the entire user area of memory. As a
result both memory and CPU are under utilized.
Itis difficult to debug a program ie. a programmer cannot correct bugs the moment it
Occurs. Moreover, debugging was feasible only offline and it used to be v
ery time
consuming.
A job could enter an infinite loop.
' A job could corrupt the monitor thus affecting pending jobs,
As this system does not use any memory protection scheme,
one job in a batch can
affect other pending jobs.fa Introduction to Perating Sy,
1.4.4 Multiprogramming System
. Multiprogramming Operating system allows multiple users to execute Multi
Programs using a single CPU concurrently ie. at the same time.
In multiprogramming several Processes are kept in the main memory and CPU execy
all these processes concurrently. It means, the CPU immediately switches from ong
Process to next that are ready to get executed (see figure 1.6)
Fig. 1.6 (Memory layout in muitiprogramming system)
Such a system is possible by having a mixture of CPU bound processes (is. the process
that mostly perform numerical calculation with little /O operations. Their CPU
utilization is high) and I/O bound processes (i.e. the processes that perform very little
computations and most of the time they perform I/O operations. Their CPU utilizationis
very low.)
* In such an operating system when one process start performing /O operations, the CPU
is allocated to another user process in the main memory that is ready to use the CPU
Thus CPU never remains idle and is always kept busy executing some processes.
* Multiprogramming does not mean that CPU executes the instructions from sever!
Programs at the same time. Rather, it means that there are number of progr
available to CPU and that a portion of one is executed, then a segment of another and ®
on.
+ Although two or more users programs reside in the main memory simultaneously
CPU is capable of executing only one instruction at a time. Hence, at any given ti
only one of the programs has control of CPU and is executing instructions, Simultaneo™*
execution of more than one program with single CPU is impossible.Introduction to Operating System iE
Main Memory
Writing
(put data
Program C
(Waiting for CPU)
Secondary
Disk Storage
Execution in
progress
Ly cPU
Fig. 1.7 (Jobs in mutiprogramming system)
A typical scenario of jobs in multiprogramming system is shown in figure 1.7. At a
particular instance of time shown in the figure, program A is not utilizing CPU as it is
busy writing output data on the disk (I/O operation). The CPU is allocated to a program
B, which is also present in the main memory. Another program C, residing in the main
memory, is waiting for the CPU to become free
In case of multiprogramming the various jobs residing in the main memory, can be in
one of the following three stages (see figures 1.8) :
1. Running: CPU is being used by the program
2. Blocked: Performing I/O operation
3. Ready: Waiting for CPU to be assigned to it.
New Job is allocated the Job
job ‘CPU for execution processing
completed
‘Job must wait
Completed for 1/0 complation
Fig. 1.8 (Three diferent states of jobs in muttiprogramming)Introduction to Operating Sry
* In our example, programs A, B and C are in blocked running and ready sty,
respectively. Since job C is in ready state, as soon as execution of job B is complete,
job B requires I/O operation, the CPU will start executing job C. In the meanwhile,
iffy
A completes its output operation, it will be in the ready state waiting for CPU.
* The various examples of multiprogramming operating system are Windows NT, os)
and UNIX.
Requirements of Multiprogramming System
The various features required by multiprogramming system are:
1. Large Memory
* For a multiprogramming to work satisfactorily, large main memory is required to
accommodate a good number of user Programs along with operating system.
2. Memory Protection
* Computers designed for multiprogramming must provide some type of memory
Protection mechanism to prevent a Program in one memory partition from changing
information or instruction of a program in another memory partition.
3. Job Status Preservation
* In multiprogramming, when one running job is blocked for V/O operation, the CPUs
taken away from that job and is given to some another job. Later on, when that job has
finished its /O operation, it need to be resumed with its execution.
* This requires preserving the status information of that job (when CPU was taken awa
from it) and restoring this information back (when CPU is given back to it)
* For this an operating system uses Process Control Block (PCB) to save the status of each
Process (discussed in chapter 3).
* Thus, in multiprogramming, before taking away the CPU from a running process, i
status is preserved in its PCB and before the process resumes its execution (when CPU®
given back to it), its status is restored back from its PCB.
4. Proper Job Mix
* A proper mix of /O-bound and CPU-bound
operations of CPU and I/O devices are balanced.
* Ifall the loaded jobs need 1/0 at the same time, the CPU will be idle.
* Thus, the main memory should contain some CPU-bound and some /O-bound jobs °°
that at least one job is always ready to utilize the CPU.
Ee ell
Processes are required so thatIntroduction to Operating System
5. CPU Scheduling
+ Ina multiprogramming system, often there will be situations in which two or more jobs
will be in the ready state, waiting for CPU to be allocated for execution.
* Insuch a case, the operating system must decide to which process or job CPU should be
allocated.
* For this a CPU scheduler selects the processes and uses different CPU scheduling
algorithms.
Advantages of Multiprogramming
1. Increased throughput. Throughput is increased by utilizing the idle-time of CPU for
running other programs that are already present in the main memory.
2. Lowered Response Time. Response time is lowered by recognizing the priority of a job
as it enters the system and by processing jobs on a priority basis.
3. Ability to assign priorities to jobs. Most multiprogramming systems have schemes for
setting priorities for rotating programs. They specify when the CPU will rotate to
another program, and which program it will rotate to.
Disadvantages of Multiprogramming
1. Multiprogramming is implemented through an operating system, which is a program
that requires space in primary storage since it must be executed by the CPU. The
operating system overhead is greater with multiprogramming that with batch
processing.
2. Jobs may have different sizes, therefore memory management is needed to
accommodate them in memory
3. Many jobs may be ready to run on the CPU, which means that CPU scheduling is
required,
Comparison between Batch processing OS and Multiprogramming OS.
No. Batch processing OS Multiprogramming OS
1. | It this system, a batch of similar jobs
that consists of data, instructions and
It allows multiple users to execute
multiple programs concurrently by
control information is submitted to a
computer operator where one job is
executed at a time.
switching a single CPU amongst various
programs,~.
frtroduetion © Operating ayy.
The various jobs are executed on FCFS
basis ice. the order in which they were
submitted.
‘As. several different algorithms >
feasible in multiprogramming envirg,
ment, the various processes are execute,
using different scheduling algorithms,
This OS does not ensure efficient CPU
utilization.
Multiprogramming OS ensures
efficient CPU utilization as severg
processes are available to CPU to keep it
busy.
Memory management process is simple
as memory space vacated by one
program upon
allocated to other program.
its completion is
‘A large memory and a sophisticated
memory management is required a
several processes reside in the memory a
the same time.
Access to the files is done on serial
basis. Also, only one program can
access the files at a particular time, so
file management is simple. Also, there
is not need to provide access control or
concurrency control mechanisms.
It requires advanced protection and
concurrency control mechanisms a
several different processes may access 2
file at the same time.
As only one program is executed at a
time, there is no contention for /O
devices. Thus, time critical device
management is not required.
As several different processes share
devices, device management function is
required in multiprogramming.
This system is slower in processing as
compared to multiprogramming.
Itis faster in processing than batch OS.
1.4.5
Multitasking System
Technically, multitasking is same as multiprogramming
In a multitasking operating system,
same time.
@ single user can execute multiple programs at
We can also say, multitasking is the system's capability to work on more than one jo
Process atthe same time. It means that whenever a job needs to perform 1/0 operatior®
the CPU can be used for executing some other job or process that is also residing i?
system and is ready to use the CPU.
a———
introduction to Operating System
7]
The term multiprogramming is used for multi-user systems ie, systems that are
simultaneously used by many users such as mainframe and server class system and the
term multitasking is used for single user system i, systems that are used by only one
user at a time such as a personal computer or a notebook computer.
Thus multitasking is the method of processing the multiple tasks concurrently in a single
user system. For example, a user is running separate program in four different windows
at the same time. The program in window 1 could be printing a document, the program
in window 2 could be displaying an e-mail of user, a spreadsheet program in window 3
could be preparing sales report and compilation of a program is in progress in window
4. In this manner, a user may work on many tasks at the same time. Thus, progress of
different tasks can be viewed on different windows in a multitasking system.
There are two types of multitasking :
1. Cooperative Multitasking
2. Preemptive Multitasking
1. Cooperative multitasking. In cooperative multitasking, a program can acquire the
CPU for the required amount of time. A program can share CPU with any other
program that is executing simultaneously, if it does not currently require the CPU.
Microsoft windows 3.x and MultiFinder for Macintosh computers are the examples
of cooperative multitasking.
2 Preemptive multitasking. In preemptive multitasking the operating system
allocates particular time to a program. The CPU is preempted if a higher priority job
arrives in a system. In this type of multitasking, programs are forced to share the
CPU whether they want to use it or not. UNIX, Windows NT and later versions of
Mac OS are the examples of preemptive multitasking.
Comparison Between Multiprogramming and Multitasking
[Ex
Multiprogramming Multitasking
It is used for single user systems ie. the
systems that are used by only one user at
It is used for multi-user systems ie., the
systems that are used by many users at
the same time. atime.
2. | it refers to the concurrent execution of | It refers to the concurrent execution of
multiple jobs that may be of same user | multiple jobs of a same user.
or different users on a single processor.
3. Multiprogramming is implemented by | Multitasking is implemented by using
using the concept of context switching.
the concept of time sharing.__
L122 |
Introduction to Operating Png
1.4.6 Multiprocessing System
* Multiprocessor system is the system that contains two or more processors or Cpy,
has ability to simultaneously execute several Programs, H
lence the name “an
Processor’,
In such a system, multiple processors share the clock, bus, memory and Petipherg
devices,
* A multiprocessor system is also known as parallel system.
Therefore, SMP exhibit peer-to-peer relationship,Introduction to Operating System
«For example, Encore’s version of UNIX for the multi-max computer uses SMP. In this
system, various processors execute copies of Unix operating system thereby executing m
processes if there are m processors.
Figure1.10 (a) shows the structure of symmetric multiprocessing system.
2. Asymmetric Multiprocessing (ASMP)
«In ASMP, different processor do different things i., they are not identical. Thus, there is
imbalance among the processors. Hence the name ‘asymmetric.
* In ASMP each processor is given a specific task and do not share equal load.
CPU-1
(Master)
CPU-3
(Slave)
(o)
Fig. 1.10 (a) Symmetric multiprocessing system (b) Asymmetric multiprocessing system
* There is master-slave relationship between the processors.
* One of the processors that control the system is called master. The other processors
follow the instruction given by the master or have predefined tasks. These are called
slaves.
Thus, in ASMP, the master processor controls, schedules and allocates the task to the
slave processors.Introduction to Operating on
* For example, processor operated with math co-processor used to handle floating.
calculations is based on asymmetric multiprocessing system.
* Figure 1.10 (b) shows the structure of asymmetric multiprocessing system.
Advantages of Multiprocessing System
1, Improved Reliability. Multiprocessing systems have better reliability than sing,
processor because of the presence of multiple processors. If one of the proces,
breaks down, the other processor(s) automatically takes over the system workload y.
repairs are made. Hence, a complete breakdown of such system can be avoided,
2. Improved throughout. Throughout is the number of jobs executed per unit time. Wi:
the use of multiple processors, parallel processing of segments of programs is possbi,
Consequently the throughout and performance of system is improved.
3. Lowered Turnaround time. Turnaround time is the difference between the time aue
submits his job to the system for processing and the time he receives results. Wher
job is divided among the multiple processors the computation of result takes less tt
As a result turnaround time is less.
4. Efficient Utilization of all resources. In addition to the processors, it also facile
more efficient utilization of all the other devices of the computer system.
5. Economical. The clock, bus, peripheral devices and memory are shared. As a rest!
is cheaper to have multiprocessor systems than multiple single processor system
Disadvantages of Multiprocessing System
1. A very sophisticated operating system is required to schedule, balance and coordi?
the input, output and processing activities of multiple CPUs.
2. A large main memory is required for accommodating the sophisticated oper
system along with several user programs.
3. Such systems are very expensive. In addition to the high changes pai ini”
regular operation and maintenance of these systems is also a costly affair.
Comparison between multiprogramming and multiprocessing
Multiprogramming
Multiprogramming concept is Multiprocessing concept is imp!
implemented in systems with a single | in systems with multiple processor
entMultiprogramming refers to the
inter-
leaved~ execution
of two or
more
processes by a single processor.
Multiprocessing refers. to
the
simultaneous execution of two or more
Processes by system with multiple
Processors, .
In such a system, a portion of one
program is executed first, then
segment of another and so on.
a
In multiprocessing, several program
segments of one or more programs are
executed simultaneously.
4 | Time sharing systems are special case | Some mainframes and super mini
of multi programming. computers use multiprocessing.
5. Tt_uses the concept of context It uses the concept of paralled processing.
switching.
& {It is usually slower than | It is faster and takes less time to process
multiprocessing system and _ takes | the jobs.
more time to process the jobs.
az
Multiprogramming systems are less
expensive as compared
multiprocessor system.
to
These system are usually more expensive,
Comparison between Multi-tasking and
Multi-processing OS.
[Een
.
[ore es
Multiprocessing
It refers to simultaneous executing of
more than one task/job by a single
processor.
It refers to simultaneous execution of
single or more than one job by more than
one processor.
Only one processor/CPU is used to
execute multiple tasks.
More than one (Multiple) processor/CPU
are used to execute single job or multiple
jobs in parallel.
It usually takes more time to execute
jobs as compared to multiprocessing.
The time taken to process the job(s) is
usually less as several processors work in
parallel.
1.4.7 Timesharing System
Timesharing refers to the allocation of computer resources in a time dependent fashion
to several programs simultaneously.Introduction to Operating Sysi_,,
nected to same compyy
t are CO! er
terminals tha!
any user
stem at the
A timesharing system has m: different users can work ona sy aa
simultaneously. Using these terminals,
time. '
ing wi PU sch
Thus, it uses multiprogramming with a special C
= scheduled ba
In timesharing system, the CPU time is divided among all the users on a sis,
eduling algorithm to achieve
Each user program is allocated a very short period of CPU time one-by-one, beginning
from the first user program and proceeding the last one, and then again beginning from
the first one.
This short period of time during which user gets the attention of the CPU is known as a
time slice, time slot or quantum. It is typically of the order of 10 to 100 milliseconds.
Thus, in timesharing, when the CPU is allocated to a user Program, the user uses the
CPU for the period of time slot.
Ttreleases the CPU under any of the following three conditions ;~
1. When the allotted time slice expires.
2. When the program needs to perform I/O operation.
3. When the execution of the program is over d
Even though it may appear that several
time,
luring the time slice,
‘Job is allocated to CPU for excution
Oe—————
introduction to Operating System
«In timesharing system, the various programs can be in one of the following three states
(sce figure 1.11):
1, Running: The user’s program currently has control of the CPU. Only one user will
be active at a time.
2. Ready: The user’s program is ready to execute but is waiting for its turn to get the
CPU. More than one user can be in ready state at a time.
3. Blocked: The user’s program is waiting for some I/O operation. More than one user
can be in wait state at a time.
Requirements of Timesharing System
Timesharing systems typically require the following additional hardware and software
features:
1. A number of terminals simultaneously connected to the system, so that multiple users
can simultaneously use the system in interactive mode.
2. Arelatively large memory to support multiprogramming.
3. Memory protection mechanism to prevent one job’s instructions and data from
interfering with other jobs.
4, Job status preservation mechanism to preserve a job's complete status information
when the CPU is taken away from it, and restoring this information back, before the
CPU is given back to it again.
5. A special CPU scheduling algorithm, which allocates the CPU for a very short period,
to each user process in a circular fashion.
6. Alarm clock mechanisms to send an interrupt signal to the CPU after every time slice.
Advantages of Timesharing System
1. Reduces CPU idle time: Timesharing reduces idle time of CPU and increases the
utilization of CPU by switching from one program to another in rapid succession.
2. Provides advantages of quick response time: The special CPU scheduling algorithm
used in time sharing systems ensures quick response time to all users.
Comparison between Multiprogramming and Timesharing OS
Sr.No. Multiprogramming Multiprocessing ]
1 It allows multiple user to execute | It is an extension of multiprogramming
multiple programs using a single CPU | system where the various computer
at the same time. resources are allocated to several user
A aeIntroduction to
Programs simultaneously
dependent manner.
| } 2. | The prime objective of this system is to | The Prime of objective of this System is,
maximize the CPU utilization by | minimize the response time by
| Providing a proper mix of CPU bound | the various TESOLITOES "among sevens
| and I/O bound processes so that CPU is Processes.
| always busy.
) 3 A context switch occurs only when the | A. context switch occurs whenever the
| Currently running process stalls and the time slot or time slice of currently
| CPU is to be allocated to some other Tunning process expires.
ae
4. This system is less complex than time | ft is more complex than a
sharing system. multiprocessing system,
The processes are not
The purpose of distributed system is
for sharing of resources.
Alpha Kernel.
Models of Distributed Operating System
‘The design of distributed operating system is based on two models:
Putery 7 iMclude small
pee large eeIntroduction to Operating System 1.29
1. Client-Server model
2. Peer-to-Peer model
1. Client-Server model: In client server model, the client send a resource request to the
server and the server in turn provides the requested resources as the response back to
client. Figure 1.12 shows the client server model.
Client
Server
Network
Client Client
Fig, 1.12 (Client-Server model)
o-Peer model: In peer-to-peer model, all the computers behave as clients. These
2. Peer-t
ces. Figure 1.13 shows
clients communicate with each other for exchange of their reso
the peer-to-peer model.
Fig. 1.13 (Peer-to-Peer model)
Advantages of Distributed System
1. Resource Sharing: If numbers of different sites are connected to one another, then anu Introduction to Operating
1.4.9 Real-time System
Syston
user at one site may be able to use the resources available at another site. Reso,
sharing provides mechanisms for sharing files at remote sites, Processing inform,
in distributed database, printing files at remote site etc.
urce
ation
2. Computation Speedup:
A distributed system allows us to divide 4 computational
work into sub-computations and distribute it among the various sites. These su
“omputations can be run concurrently and thereby increases the speed of
another site.
Reliability: If one site fails in a distributed system,
oPerating, giving the system better reliability,
5. Communication: When several site:
network, the users at different sites
the remaining sites can continue
= are connected to one another by a communi¢aiion
can exchange information,
Thus, a real time system is one thai
* must react to inputs and respond to them quickly. It
cannot afford to be late with a resp.
onse to an event.
A real time system is often used a:
injection system, robotics, air-traffi ging systems, systems that
id weapon systems, traffic light
system, radar system and teleph
Thus, providing quick res
However, resource utilization
In real-time system, the various functions like
1O management and file management are
* Process scheduling: The real time system uses priority based pre-emptive
scheduling, Each process is assigned a certain level of priority and the process with
the highest priority is allocated the processey among those which are in ready state.>:
tredvetion to Operating System
Memory management: In real time system, the processes remain in primary memory
ost of the time in order to provide quick response. There is very little swapping
memory
ED
for mi
of program between primary memory and secondary memory. Thus,
management in a real time system is less demanding as compared to other types of
multiprogramming system.
V/O device management: Time critical device management is main requirement of
real time system, It also uses features like interrupt management and I/O buffering.
+ File management: In real time system, file management does not aim at efficient
utilization of secondary storage rather main objective is to provide fast access.
‘+ Real time operating systems are categorized into :
1. Hard real time systems
2. Soft real time systems
Hard real-time systems complete the critical tasks within the definite interval of
constraints. If the critical task is not completed within the time constraint, then the hard
real time system fails.
Thus, a hard real time system has to com
and a single miss leads to critical failure.
| time system is a flight controller system in which any miss in
plete all the processes within a definite deadline
© The example of hard rea
deadline leads to a crash or an unstable aircraft.
Soft real-time systems are less restrictive in nature and are not affected by the lapse of
time interval and do not cause any critical failure.
© Soft real time systems are used in the area of multimedia, virtual reality.
* The example of soft real time system is nuclear power stations and airbags.
+ Examples of real time operating system are Harmony (Developed by National Research
Council of Canada), Maruti (University of Maryland), OS9 (Microware System
Corporation), RTEMs (Real Stone Military Arsenal)
Comparison between Soft real time and Hard real time system
"Soft real time system Hard real time system
Hard real time systems have absolute
deadlines. It requires having good response
all the time. Failing to respond properly is
fairly unacceptable.
Soft real time systems require good
response but allow some fudge in
deadlines.SS
=
[2
3
Real time operating system for cordless
bar code reader needs goods response
| time but some limited delay due to some
| problem is acceptable
| It supports advanced operating, system
| features. So it has expanded uses than
| hard real time operating system.
Introduction to Operating System
Example of hard real time system is System |
used for nuclear reactor. These system don
afford delay in response to any Problem fo,
even 1% of time.
Most secondary storage and advanceq
operating system features are missing as
they enhance uncertainty about amount of
time an operating will take. For instance
virtual memory is not used in such systems,
Comparison between Batch Processing OS and Real Time os.
ee Batch Processing OS
Rang os
Batch system are suited for applications
that do not require immediate and quick
Real the system are used for applications
that require
immediate and quick
ete th” stihl “aime searieneased return the correct result in
constraints, tigid time constraints.
2 | does not involve any user interaction Real time systems may require user
| as the batch of similar jobs is collected by interaction,
| oPerator who loads the various jobs into
the system,
3. | Various processes are Scheduled on | tt uses priority based preemptive
FCFS basis, scheduli
ee =f luling.
a File access is done on
serial basis and
for fast or quick access,
A thread is a dispatchable unit ¢
the program counter and stack
subroutine branching),
of
Pointer)
A thread executes se
another thread.
|
File management aims at providing fast
| and quick access,
Time critical device management is the
f
work. It includes
and its o
Seren, Als tierra abi So tha
main rey
‘uirement of real time system.
® Processor context (which includes
wn data area for a stack (to enable
t the processor can turn topp
introduction to Operating System
Thus, a thread represents a light weight process and is the smallest unit of CPU
utilization. It is like a ‘miniprocess’,
A process, on other hand is a collection of one or more threads and associated system
resources (such as memory containing both data and code, open files and devices).
A thread is not a process by itself. It cannot run on its own. It always run within a
| process
! Thus, a multithreaded process may have multiple execution flows, different ones
belonging to different threads. (see figure 1.14).
function function function3
Registers Registers Registers
Aprocess
Stack ‘Stack Stack address
| space
| Thread 1 Thread 2 Thread 3
Executes Executes Executes
Fig. 1.14 (A process in multithreaded system)
* As shown in figure 1.14 all the threads of a process share same private address space of
the process and share all the resources acquired by the process.
* By breaking a single application into multiple threads, the programmer has great control
over the modularity of the application and the timing of application-related events.
* Multithreading is useful for applications that perform a number of essentially
independent tasks that do not need to be serialized. For example, a database server that
listens for and processes several client requests.
* Also, when there are multiple threads running in the same process switching among
es.
threads involve less processor overhead than switching among proces
* Threads are also used for structuring processes that are part of the OS kernel.
* Different systems implement the thread concept differently. Some systems have user-
level library routines to manage threads in process.be multithread, but OS see only the process and Tt th
yess can
An application pro
threads it contain.
° es a syste :
When any thread ae the process can make any progress until the blocked i
and no other thread 1
read ‘andling
system call. oS quired for
ten say that OS is single threaded, but applications are multithreaded.
Thus, we often say tha is thi 4
The various states exhibited by windows thread are : (see figure 1.15)
em call and is blocked, the entire process is also blocke
1. Ready. A ready thread may be scheduled for execution. The kernel dispatcher keeps
track of all ready threads and schedules them in priority order.
2. Standby. A thread Q that has been selected to run next on a particular processor is
said to be in standby state. The thread waits in this state until the processor is made
available. Ifthe priority of standby thread is higher than the thread that is currently
running on the processor then this running thread may be preempted. Otherwise
the standby thread waits until the running thread blocks or its time slice expires.
Running. The thread that is currently utilizing CPU is in running state. It keeps the
Processor until it is preempted by a higher Priority thread or it gets blocked or its
time slice expires. In the first two cases, it goes back to ready state.
Waiting. A thread enters waiting state when :
=
(@) itis blocked on an event, eg. I/O.
©) it voluntarily waits for synchronization Purpose.
(c) an environment subsystem directs the thread to suspend itself.
8 Condition ig
© available.
Fesources aryntroduction to Operating System
5. Transition. A thread enters this state after waiting if it is ready to run but resources
are not available. e,
» the thread’s stack may be paged out of memory. When
resources are available, the thread goes to the ready state.
6. Terminated. A thread can be terminated by itself, by another thread or when its
parent process terminates.
«The various advantages of multithreaded environment are discussed in chapter 3.
Comparison between Real time operating system and
Timesharing operating system
[SINo. | _ Realtime operating system
Timesharing operating system
1
A real time operating system has well
defined fixed time constraints. Process must
be done within the defined constraints or
system will fail.
The time sharing system executes one job up |
to certain period of time and then switches
to another job and so on.
pv
Certain operating system features like job
scheduling, memory
limited use.
swapping have
Concepts like job scheduling, memory
swapping are used for handling timesharing
systems.
Itexecutes one job dedicatedly.
It seems to execute many jobs at the same
time.
Real time operating system enables us to
program an application with predictable
results.
It is impossible to predict response in
advance in timesharing system.
L
Real-time operating systems give users the
ability to prioritize tasks so that the most
ctitical task can always take control of the
processor when needed.
In timesharing system, high priority tasks
can preempt lower priority tasks, making it
impossible to guarantee a response time for
certain critical applications
WE}protection AND SECURITY
Protection refers to a mechanism for controlling the access of programs, processes, or
users to the resources defined by computer system.
The concept of protection came with the advent of multiprogramming where several
Processes compete for the use of CPU.
The purpose was to confine each user’s program to its assigned area of memory S° that
the programs cannot interfere and harm each other.Protection in Computer System
Introduction to Operating Syste
Protection in main memory is particularly important because of address translation
e
Purpose of protection is to allow concurrently running processes to share the comma,
n
ysical address space.
Protection also ensures that only those processes that have gained proper authorization
from the operating system can Operate on memory segments, the CPU, files and other
resources.
In the system
contiguous memory allocation, protection is usually accomplished
by the use of limit registers, Each Program is assigned a specific limit in terms of
limit register is checked to ensure that reference is within the bound of program
otherwise the access to memory is denic
y the use of a page table. This Page table lists
‘at a program can access, In addition the table store access rights such as
Tead, write or execute for each individual Page. Each process has its own page table.
Whenever an access to any page of a program is made, a memory management unit first
check whether the Page requested exits in Program’s address Space or not and then it
checks the type of access allowed on that page.
In paging system, protection is achieved b
all the pages th:
any segment of program, the system verifies the Presence of the segment in the
Program's address space and then it checks whether the offset is valid or not and th
type of access allowed,
resources,introduction to Operating System
«Thus securing a system involves following measures :
1. Preventing unauthorized access i.e, hiding the information from unauthorized users.
2. Protecting the system from malicious (intentional) damage or misuse. Such
intentional misuse can be of the following kinds (i) Theft of information
(ii) Unauthorized modification of data (iii) Unauthorized destruction of data
3. Protecting the system against accidental misuse.
«The term security is often associated with protection. However, there is a difference
between them. Protection is defined as guarding the user information against other
authorized users within the system whereas security is defined as guarding the user
information against unauthorized users outside the system.
Eile aar Sele se ce ty
Q.
Ans.
Q
Write a note on distributed operating system.
A distributed system is a collection of processors located in geographical dispersed
physical location.
In this system, the workload is distributed or divided between two or more computers
that are linked together by a communication network. That is, the different processors
communicate using communication links, such as telephone lines and buses.
The various processors do not share memory, clock, or peripheral devices. Instead each
processor has its own local memory.
The processors in a distributed system vary in size and function. They may include small
microprocessors, workstations microcomputers, mainframe computers and large general
purpose computers. The various processors are also called as sites, nodes, hosts or machine.
The purpose of distributed system is to provide an efficient and convenient environment
for sharing of resources.
What are the two main functions of operating system?
Or
List two main functions of an operating system.
The primary objective of operating system is to improve the performance and efficiency
of a computer system and make it user friendly. Thus, like a manager of a company, an
operating system is responsible for smooth and efficient operation of the entire computer
‘system.