Cs403pc Operating Systems Unit 1
Cs403pc Operating Systems Unit 1
A computer system has many resources (hardware and software), which may be required to complete a
task. The commonly required resources are input/output devices, memory, file storage space, CPU, etc.
The operating system acts as a manager of the above resources and allocates them to specific programs
and users, whenever necessary to perform a particular task. Therefore the operating system is the
resource manager i.e. it can manage the resource of a computer system internally. The resources are
processor, memory, files, and I/O devices.
In simple terms, an operating system is an interface between the computer user and the machine.
It is very important for you that every computer must have an operating system in order to run other
programs. The operating system mainly coordinates the use of the hardware among the various system
programs and application programs for various users.
An operating system acts similarly like government means an operating system performs no useful
function by itself; though it provides an environment within which other programs can do useful work.
Below we have an abstract view of the components of the computer
system:
In the above picture:
The Computer Hardware contains a central processing unit(CPU), the memory, and the
input/output (I/O) devices and it provides the basic computing resources for the system.
The Application programs like spreadsheets, Web browsers, word processors, etc. are used
to define the ways in which these resources are used to solve the computing problems of the users.
And the System program mainly consists of compilers, loaders, editors, OS, etc.
The Operating System is mainly used to control the hardware and coordinate its use among the
Advantages:
1. The overall time taken by the system to execute all the programmes will be reduced.
2. The Batch Operating System can be shared between multiple users.
Disadvantages:
1. Manual interventions are required between two batches.
2. The CPU utilization is low because the time taken in loading and unloading of batches is very
high as compared to execution time.
Multiprogramming
Sharing the processor, when two or more programs reside in memory at the same time, is referred
as multiprogramming. Multiprogramming assumes a single shared processor. Multiprogramming
increases CPU utilization by organizing jobs so that the CPU always has one to execute.
system.
An OS does the following activities related to multiprogramming.
The operating system keeps several jobs in memory at a time.
This set of jobs is a subset of the jobs kept in the job pool.
The operating system picks and begins to execute one of the jobs in the memory.
Multiprogramming operating systems monitor the state of all active programs and system resources
using memory management programs to ensures that the CPU is never idle, unless thereare no jobs
to process.
Advantages
High and efficient CPU utilization.
User feels that many programs are allotted CPU almost simultaneously.
Disadvantages
CPU scheduling is required.
Parallel Processing
Advantages
1. It saves time and money as many resources working together will reduce the time and cut
potential costs.
2. It can be impractical to solve larger problems on Serial Computing.
3. It can take advantage of non-local resources when the local resources are finite.
4. Serial Computing ‘wastes’ the potential computing power, thus Parallel Computing makes
better work of the hardware.
Disadvantages
1. It addresses such as communication and synchronization between multiple sub-tasks and
mechanism.
3. The algorithms or programs must have low coupling and high cohesion. But it’s difficult to
An operating system is an interface which provides services to both the user and to the
programs. It provides an environment for the program to execute. It also provides users with the
services of how to execute programs in a convenient manner. The operating system provides some
services to program and also to the users of those programs. The specific services provided by the OS
are off course different.
Following are the common services provided by an operating system:
1. Program execution
2. I/O operations
3. File system manipulation
4. Communication
5. Error detection
6. Resource allocation
7. Protection
1) Program Execution
An operating system must be able to load many kinds of activities into the memory and to run it.
The program must be able to end its execution, either normally or abnormally.
A process includes the complete execution of the written program or code. There are some of the
I/O devices are required for any running process. In I/O a file or an I/O devices can be involved.
I/O operations are the read or write operations which are done with the help of input-output
devices.
Operating system give the access to the I/O devices when it required.
can store files on the secondary storage devices. For long-term storage purpose. examples of storage
media include magnetic tape, magnetic disk and optical disk drives like CD, DVD.
A file system is a collection of directories for easy understand and usage. These directories contain
some files. There are some major activities which are performed by an operating system withrespect
to file management.
o The operating system gives an access to the program for performing an operation on the
file.
o Programs need to read and write a file.
o The user can create/delete a file by using an interface provided by the operating system.
o The operating system provides an interface to the user creates/ delete directories.
o The backup of the file system can be created by using an interface provided by the
operating system.
4) Communication
In the computer system, there is a collection of processors which do not share memory peripherals
devices or a clock, the operating system manages communication between all the processes. Multiple
processes can communicate with every process through communication lines in the network. There
are some major activities that are carried by an operating system with respect to communication.
Two processes may require data to be transferred between the process.
Both the processes can be on one computer or a different computer, but are connected through a
computer network.
5) Error handling
An error is one part of the system that may cause malfunctioning of the complete system. The
operating system constantly monitors the system for detecting errors to avoid some situations. This
Department of CSE Page 10 of 13
give relives to the user of the worry of getting an error in the various parts of the system causing
malfunctioning.
The error can occur anytime and anywhere. The error may occur anywhere in the computer system
like in CPU, in I/O devices or in the memory hardware. There are some activities that are performed
by an operating system:
The OS continuously checks for the possible errors.
6) Resource management
When there are multiple users or multiple jobs running at the same time resources must be allocated
to each of them. There are some major activities that are performed by an operating system:
The OS manages all kinds of resources using schedulers.
7) Protection
The owners of information stored in a multi-user computer system want to control its use. When
several disjoints processes execute concurrently it should not be possible for any process to interfere
with another process. Every process in the computer system must be secured and controlled.
Operating system can be implemented with the help of various structures. The structure of the OS
depends mainly on how the various common components of the operating system are interconnected
and melded into the kernel. Depending on this we have following structures of the operating system:
Simple structure:
Such operating systems do not have well defined structure and are small, simple and limited systems.
The interfaces and levels of functionality are not well separated. MS-DOS is an example of such
operating system. In MS-DOS application programs are able to access the basic I/O routines. These
types of operating system cause the entire system to crash if one of the user programs fails.
Diagram of the structure of MS-DOS is shown below.
Layered structure:
An OS can be broken into pieces and retain much more control on system. In this structure the OS
is broken into number of layers (levels). The bottom layer (layer 0) is the hardware and the topmost
layer (layer N) is the user interface. These layers are so designed that each layer uses the functions of
the lower level layers only. This simplifies the debugging process as if lower level layers are debugged
and an error occurs during debugging then the error must be on that layer only as the lower level
layers have already been debugged.
The main disadvantage of this structure is that at each layer, the data needs to be modified and passed
on which adds overhead to the system. Moreover careful planning of the layers is necessary as a layer
can use only lower level layers. UNIX is an example of this structure.