You are on page 1of 18

Chapter 1: Introduction

What is an Operating System?

An Operating System (OS) is a software that acts as an interface between computer


hardware components and the user. Every computer system must have at least one operating
system to run other programs. Applications like Browsers, MS Office, Notepad Games, etc.,
need some environment to run and perform its tasks.

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.

An operating system or OS is software installed on a computer's hard drive that enables the


computer hardware to communicate and operate with the computer software. Without a
computer operating system, a computer and software programs would be useless. 

Functions of Operating System

Some typical operating system functions may include managing memory, files, processes, I/O
system & devices, security, etc.

Below are the main functions of Operating System:

Functions of Operating System

1|Chapt. 1
In an operating system software performs each of the function:

1. Process management:- Process management helps OS to create and delete processes.


It also provides mechanisms for synchronization and communication among
processes.

2. Memory management:- Memory management module performs the task of


allocation and de-allocation of memory space to programs in need of this resources.

3. File management:- It manages all the file-related activities such as organization


storage, retrieval, naming, sharing, and protection of files.

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.

5. I/O System Management: One of the main objects of any OS is to hide the


peculiarities of that hardware devices from the user.

6. Secondary-Storage Management: Systems have several levels of storage which


includes primary storage, secondary storage, and cache storage. Instructions and data
must be stored in primary storage or cache so that a running program can reference it.

7. Security:- Security module protects the data and information of a computer system


against malware threat and authorized access.

8. Command interpretation: This module is interpreting commands given by the and


acting system resources to process that commands.

9. Networking: A distributed system is a group of processors which do not share


memory, hardware devices, or a clock. The processors communicate with one another
through the network.

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.

Features of Operating System (OS) :

Here is a list important features of OS:

 Protected and supervisor mode


 Allows disk access and file systems Device drivers Networking Security
 Program Execution
 Memory management Virtual Memory Multitasking
 Handling I/O operations
 Manipulation of the file system
 Error Detection and handling
 Resource allocation
 Information and Resource Protection

Advantage of using Operating System

 Allows you to hide details of hardware by creating an abstraction


 Easy to use with a GUI
 Offers an environment in which a user may execute programs/applications
 The operating system must make sure that the computer system convenient to use
 Operating System acts as an intermediary among applications and the hardware
components
 It provides the computer system resources with easy to use format
 Acts as an intermediator between all hardware's and software's of the system

Disadvantages of using Operating System

 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?

Some widely used operating systems are as follows- 

Batch 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:

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.

Examples of Batch based Operating System: Payroll System, Bank Statements, etc. 

Time-Sharing Operating System


In a Multi-tasking Operating System, more than one processes are being executed at a
particular time with the help of the time-sharing concept. So, in the time-sharing
environment, we decide a time that is called time quantum and when the process starts its
execution then the execution continues for only that amount of time and after that, other
processes will be given chance for that amount of time only. In the next cycle, the first
process will again come for its execution and it will be executed for that time quantum only
and again next process will come. This process will continue. The following image
describes the working of a Time-Sharing Operating System.

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.

Examples of Time-Sharing OSs are: Multics, Unix, etc. 

Distributed Operating System


In a Distributed Operating System, we have various systems and all these systems have
their own CPU, main memory, secondary memory, and resources. These systems are
connected to each other using a shared communication network. Here, each system can
perform its task individually. The best part about these Distributed Operating System is
remote access i.e. one user can access the data of the other system and can work
accordingly. So, remote access is possible in these distributed Operating Systems. The
following image shows the working of a Distributed Operating System.

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.

2. Resources are shared between each other.

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.

2. If there is a problem in the communication network then the whole communication


will be broken.

Examples of Distributed Operating System are- LOCUS, etc. 

Real-time Operating System


The Real-time Operating Systems are used in the situation where we are dealing with some
real-time data. So, as soon as the data comes, the execution of the process should be done

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.

Operating System - Services

Following are a few common services provided by an operating system −

 Program execution

 I/O operations

 File System manipulation

 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 −

 Loads a program into memory.

 Executes the program.

 Handles program's execution.

 Provides a mechanism for process synchronization.

 Provides a mechanism for process communication.

 Provides a mechanism for deadlock handling.

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.

File system manipulation

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 −

 Program needs to read a file or write a file.

 The operating system gives the permission to the program for operation on file.

 Permission varies from read-only, read-write, denied and so on.

 Operating System provides an interface to the user to create/delete files.

 Operating System provides an interface to the user to create/delete directories.

 Operating System provides an interface to create the backup of file system.

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.

 Communication may be implemented by two methods, either by Shared Memory or


by Message Passing.

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 −

 The OS constantly checks for possible errors.

 The OS takes an appropriate action to ensure correct and consistent computing.

Resource Management

In case of multi-user or multi-tasking environment, resources such as main memory, CPU


cycles and files storage are to be allocated to each user or job. Following are the major
activities of an operating system with respect to resource management −

 The OS manages all kinds of resources using schedulers.

 CPU scheduling algorithms are used for better utilization of CPU.

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.

Protection refers to a mechanism or a way to control the access of programs, processes, or


users to the resources defined by a computer system. Following are the major activities of an
operating system with respect to protection −

 The OS ensures that all access to system resources is controlled.

 The OS ensures that external I/O devices are protected from invalid access attempts.

 The OS provides authentication features for each user by means of passwords.

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. 

What is a System Call?

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.

Example of System Call

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.

 First call is to write a prompting message on the screen


 Second, to read from the keyboard, the characters which define the two files.

How System Call Works?

Here are the steps for System Call in 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.,

Step 4) The execution of user processes resumed in Kernel mode.

Why do you need System Calls in OS?

Following are situations which need system calls in OS:

 Reading and writing from files demand system calls.


 If a file system wants to create or delete files, system calls are required.
 System calls are used for the creation and management of new processes.
 Network connections need system calls for sending and receiving packets.
 Access to hardware devices like scanner, printer, need a system call.

Types of System calls

Here are the five types of System Calls in OS:

 Process Control
 File Management

13 | C h a p t . 1
 Device Management
 Information Maintenance
 Communications

System programs:

System Programming can be defined as the act of building Systems Software using


System Programming Languages. According to Computer Hierarchy, one which comes at
last is Hardware. Then it is Operating System, System Programs, and finally Application
Programs. Program Development and Execution can be done conveniently in System
Programs. Some of the System Programs are simply user interfaces, others are complex. It
traditionally lies between the user interface and system calls. 

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.

System Programs Purpose

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.

Types of System Programs

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.

Program Loading and Execution

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.

Programming Language Support

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.

Some examples of system program in O.S. are – 

 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 −

In MS-DOS, applications may bypass the operating system.

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.

An image demonstrating the layered approach is as follows −

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

You might also like