Chapter 1 Introduction OS
Chapter 1 Introduction OS
The OS helps you to communicate with the computer without knowing how to speak the
computer's language. It is not possible for the user to use any computer or mobile device
without having an operating system.
Some typical operating system functions may include managing memory, files, processes, I/O
system & devices, security, etc.
1|Chapt. 1
In an operating system software performs each of the function:
4. Device Management: Device management keeps tracks of all devices. This module
also responsible for this task is known as the I/O controller. It also performs the task
of allocation and de-allocation of the devices.
10. Job accounting: Keeping track of time & resource used by various job and users.
2|Chapt. 1
11. Communication management: Coordination and assignment of compilers,
interpreters, and another software resource of the various users of the computer
systems.
If any issue occurs in OS, you may lose all the contents which have been stored in
your system
Operating system's software is quite expensive for small size organization which adds
burden on them. Example Windows
It is never entirely secure as a threat can occur at any time
3|Chapt. 1
What are the types of an Operating System?
In a Batch Operating System, the similar jobs are grouped together into batches with the
help of some operator and these batches are executed one by one. For example, let us
assume that we have 10 programs that need to be executed. Some programs are written in
C++, some in C and rest in Java. Now, every time when we run these programmes
individually then we will have to load the compiler of that particular language and then
execute the code. But what if we make a batch of these 10 programmes. The benefit with
this approach is that, for the C++ batch, you need to load the compiler only once. Similarly,
for Java and C, the compiler needs to be loaded only once and the whole batch gets
executed. The following image describes the working of a Batch Operating System.
This type of operating system does not interact with the computer directly. There is an
operator which takes similar jobs having the same requirement and group them into
batches. It is the responsibility of the operator to sort jobs with similar needs.
Advantages:
1. The overall time taken by the system to execute all the programmes will be reduced.
4|Chapt. 1
2. The Batch Operating System can be shared between multiple users.
Disadvantages:
2. The CPU utilization is low because the time taken in loading and unloading of
batches is very high as compared to execution time.
Each task is given some time to execute so that all the tasks work smoothly. Each user gets
the time of CPU as they use a single system. These systems are also known as Multitasking
Systems. The task can be from a single user or different users also. The time that each task
gets to execute is called quantum. After this time interval is over OS switches over to the
next task.
5|Chapt. 1
Advantages:
1. Since equal time quantum is given to each process, so each process gets equal
opportunity to execute.
2. The CPU will be busy in most of the cases and this is good to have case.
Disadvantages:
1. Process having higher priority will not get the chance to be executed first because
the equal opportunity is given to each process.
6|Chapt. 1
Advantages:
1. Since the systems are connected with each other so, the failure of one system can't
stop the execution of processes because other systems can do the execution.
3. The load on the host computer gets distributed and this, in turn, increases the
efficiency.
Disadvantages:
1. Since the data is shared among all the computers, so to make the data secure and
accessible to few computers, you need to put some extra efforts.
7|Chapt. 1
and there should be no delay i.e. no buffer delays should be there. Real-time OS is a time-
sharing system that is based on the concept of clock interrupt. So, whenever you want to
process a large number of request in a very short period of time, then you should use Real-
time Operating System. For example, the details of the temperature of the petroleum
industry are very crucial and this should be done in real-time and in a very short period of
time. A small delay can result in a life-death situation. So, this is done with the help of
Real-time Operating System. There are two types of Real-time Operating System:
1. Hard Real-time: In this type, a small delay can lead to drastic change. So, when the
time constraint is very important then we use the Hard Real-time.
2. Soft Real-time: Here, the time constraint is not that important but here also we are
dealing with some real-time data.
Advantages of RTOS:
Maximum Consumption: Maximum utilization of devices and system, thus more
output from all the resources
Task Shifting: The time assigned for shifting tasks in these systems are very less. For
example, in older systems, it takes about 10 microseconds in shifting one task to
another, and in the latest systems, it takes 3 microseconds.
Focus on Application: Focus on running applications and less importance to
applications which are in the queue.
Real-time operating system in the embedded system: Since the size of programs are
small, RTOS can also be used in embedded systems like in transport and others.
Error Free: These types of systems are error-free.
Memory Allocation: Memory allocation is best managed in these types of systems.
Disadvantages of RTOS:
Limited Tasks: Very few tasks run at the same time and their concentration is very less
on few applications to avoid errors.
Use heavy system resources: Sometimes the system resources are not so good and they
are expensive as well.
Complex Algorithms: The algorithms are very complex and difficult for the designer
to write on.
Device driver and interrupt signals: It needs specific device drivers and interrupts
signals to respond earliest to interrupts.
8|Chapt. 1
Thread Priority: It is not good to set thread priority as these systems are very less
prone to switching tasks.
Examples of Real-Time Operating Systems are: Scientific experiments, medical imaging
systems, industrial control systems, weapon systems, robots, air traffic control systems, etc.
Program execution
I/O operations
Communication
Error Detection
Resource Allocation
Protection
Program execution
Operating systems handle many kinds of activities from user programs to system programs
like printer spooler, name servers, file server, etc. Each of these activities is encapsulated as
a process.
A process includes the complete execution context (code to execute, data to manipulate,
registers, OS resources in use). Following are the major activities of an operating system
with respect to program management −
I/O Operation
9|Chapt. 1
An I/O subsystem comprises of I/O devices and their corresponding driver software. Drivers
hide the peculiarities of specific hardware devices from the users.
An Operating System manages the communication between user and device drivers.
I/O operation means read or write operation with any file or any specific I/O device.
Operating system provides the access to the required I/O device when required.
A file represents a collection of related information. Computers can store files on the disk
(secondary storage), for long-term storage purpose. Examples of storage media include
magnetic tape, magnetic disk and optical disk drives like CD, DVD. Each of these media has
its own properties like speed, capacity, data transfer rate and data access methods.
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions. Following are the major activities of an
operating system with respect to file management −
The operating system gives the permission to the program for operation on file.
Communication
In case of distributed systems which are a collection of processors that do not share memory,
peripheral devices, or a clock, the operating system manages communications between all
the processes. Multiple processes communicate with one another through communication
lines in the network.
The OS handles routing and connection strategies, and the problems of contention and
security. Following are the major activities of an operating system with respect to
communication −
10 | C h a p t . 1
Two processes often require data to be transferred between them
Both the processes can be on one computer or on different computers, but are
connected through a computer network.
Error handling
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or in the
memory hardware. Following are the major activities of an operating system with respect to
error handling −
Resource Management
Protection
Considering a computer system having multiple users and concurrent execution of multiple
processes, the various processes must be protected from each other's activities.
The OS ensures that external I/O devices are protected from invalid access attempts.
11 | C h a p t . 1
System calls:
A system call is a way for a user program to interface with the operating system. The
program requests several services, and the OS responds by invoking a series of system calls
to satisfy the request. A system call can be written in assembly language or a high-level
language like C or Pascal.
A system call is a method for a computer program to request a service from the kernel of
the operating system on which it is running. A system call is a method of interacting with the
operating system via programs. A system call is a request from computer software to an
operating system's kernel.
For example if we need to write a program code to read data from one file, copy that data into
another file. The first information that the program requires is the name of the two files, the
input and output files.
In an interactive system, this type of program execution requires some system calls by OS.
12 | C h a p t . 1
As you can see in the above-given System Call example diagram.
Step 1) The processes executed in the user mode till the time a system call interrupts it.
Step 2) After that, the system call is executed in the kernel-mode on a priority basis.
Step 3) Once system call execution is over, control returns to the user mode.,
Process Control
File Management
13 | C h a p t . 1
Device Management
Information Maintenance
Communications
System programs:
System programs provide an environment where programs can be developed and executed. In
the simplest sense, system programs also provide a bridge between the user interface and
system calls. In reality, they are much more complex. For example, a compiler is a complex
system program.
14 | C h a p t . 1
The system program serves as a part of the operating system. It traditionally lies between the
user interface and the system calls. The user view of the system is actually defined by system
programs and not system calls because that is what they interact with and system programs
are closer to the user interface.
System programs can be divided into seven parts. These are given as follows:
Status Information
The status information system programs provide required data on the current or past status of
the system. This may include the system date, system time, available memory in system, disk
space, logged in users etc.
Communications
These system programs are needed for system communications such as web browsers. Web
browsers allow systems to communicate and access information from the network as
required.
File Manipulation
These system programs are used to manipulate system files. This can be done using various
commands like create, delete, copy, rename, print etc. These commands can create files,
delete files, copy the contents of one file into another, rename files, print them etc.
The system programs that deal with program loading and execution make sure that programs
can be loaded into memory and executed correctly. Loaders and Linkers are a prime example
of this type of system programs.
File Modification
System programs that are used for file modification basically change the data in the file or
modify it in some other way. Text editors are a big example of file modification system
programs.
15 | C h a p t . 1
Application Programs
Application programs can perform a wide range of services as per the needs of the users.
These include programs for database systems, word processors, plotting tools, spreadsheets,
games, scientific applications etc.
These system programs provide additional support features for different programming
languages. Some examples of these are compilers, debuggers etc. These compile a program
and make sure it is error free respectively.
Windows 10
Mac OS X
Ubuntu
Linux
Unix
Android
Anti-virus
Disk formatting
Computer language translators
System Structure:
An operating system is a construct that allows the user application programs to interact with
the system hardware. Since the operating system is such a complex structure, it should be
created with utmost care so it can be used and modified easily. An easy way to do this is to
create the operating system in parts. Each of these parts should be well defined with clear
inputs, outputs and functions.
Simple Structure
There are many operating systems that have a rather simple structure. These started as small
systems and rapidly expanded much further than their scope. A common example of this is
MS-DOS. It was designed simply for a niche amount for people. There was no indication that
it would become so popular.
16 | C h a p t . 1
An image to illustrate the structure of MS-DOS is as follows −
Layered Structure
One way to achieve modularity in the operating system is the layered approach. In this, the
bottom layer is the hardware and the topmost layer is the user interface.
17 | C h a p t . 1
As seen from the image, each upper layer is built on the bottom layer. All the layers hide
some structures, operations etc from their upper layers.
18 | C h a p t . 1