Download as pdf or txt
Download as pdf or txt
You are on page 1of 73

Introduction

Operating system is a computer program that manages the


hardware and software resources of a computer.

An Operating System can be defined as an interface between


user and hardware. It is responsible for the execution of all
the processes, Resource Allocation, CPU management, File
Management and many other tasks.

The purpose of an operating system is to provide an


environment in which a user can execute programs in
convenient and efficient manner.
Structure of a Computer system
 Users (people who are using
the computer)
 Application Programs
(Compilers, Databases, Games,
Video player, Browsers, etc.)
 System Programs (Shells,
Editors, Compilers, etc.)
 Operating System ( A special
program which acts as an
interface between user and
hardware )
 Hardware ( CPU, Disks,
Memory, etc)
Functions of OS
Resource management: OS allocates resources like memory,
processor, and storage to different tasks.
Memory management: OS manages computer memory
allocation and ensures that each program can access the
memory it needs.
Process management: OS creates and manages processes and
units of work that computer executes.
File management: OS manages files, organizes them, and
grants access to different programs and users.
Security: OS includes security features to protect the
computer from unauthorized access and viruses.
User interface: OS provides users with two interfaces to
interact with the computer: a graphical user interface (GUI)
and a command-line interface (CLI).
Networking: Many OperatingSystems include support for
networking, allowing the computer to communicate and exchange
data with other devices over a network, such as the internet or a
local area network (LAN).

Device management: OS manages devices connected to the


computer, such as printers, keyboards, and storage devices.

Software installation and updates: OS provides a mechanism for


installing and updating software applications.
Objectives
OS has three main objectives.
• Convenience: Making the computer user-friendly, as seen in
modern OS with intuitive graphical user interfaces.

• Efficiency: It ensures efficient and easy utilization of system


resources.

• Ability to Develop: Operating Systems are designed to facilitate


the development, testing, and integration of new system functions
without disrupting service.
Simple Batch Operating Systems
• In this technique, similar types of jobs were batched together and executed
in time.

• In Batch operating system, access is given to more than one person; they
submit their respective jobs to the system for the execution.

• The system put all of the jobs in a queue on the basis of first come first
serve and then executes the jobs one by one. The users collect their
respective output when all the jobs get executed.

• The purpose of this operating system was mainly to transfer control from
one job to another as soon as the job was completed.

• It contained a small set of programs called the resident monitor that always
resided in one part of the main memory. The remaining part is used for
servicing jobs.
Advantage:
The use of a resident monitor improves computer efficiency as
it eliminates CPU time between two jobs.

Disadvantages:
1.Starvation
(There are five jobs J1, J2 and J3 present in the batch. If the
execution time of J1 is very high, then the other four jobs will
never be executed, or they will have to wait for a very long
time. Hence the other processes get starved.)

2. No interaction between user and computer.


(Batch Processing is not suitable for jobs that are dependent on
the user's input. If a job requires the input of two numbers from
the console, then it will never get it in the batch processing
scenario since the user is not present at the time of execution.)
Multiprogramming Operating System
• Multiprogramming is an extension to batch processing where
the CPU is always kept busy. Each process needs two types of
system time: CPU time and I/O time.
• In a multiprogramming environment, when a process does its
I/O, The CPU can start the execution of other processes.
Therefore, multiprogramming improves the efficiency of the
system.
Advantages:
• CPU is not idle. i.e, CPU has always one program to execute.
• Response time can also be reduced.
Disadvantages:
Multiprogramming systems provide an environment in which
various systems resources are used efficiently, but they do not
provide any user interaction with the computer system.
Multiprocessing Operating System
In Multiprocessing, Parallel computing is achieved. There are more than
one processors present in the system which can execute more than one
process at the same time.

Advantages:
• Increased reliability: Due to the multiprocessing system, processing
tasks can be distributed among several processors. This increases
reliability as if one processor fails, the task can be given to another
processor for completion.

• Increased throughout: As several processors increase, more work can be


done in less.

Disadvantages:
Multiprocessing operating system is more complex and sophisticated as it
takes care of multiple CPUs simultaneously.
Multitasking Operating System
The multitasking operating system is a logical extension of a
multiprogramming system that enables multiple programs
simultaneously. It allows a user to perform more than one
computer task at the same time.

Advantages :
 This operating system is more suited to supporting multiple
users simultaneously.
 The multitasking operating systems have well-defined
memory management.

Disadvantages:
The multiple processors are busier at the same time to complete
any task in a multitasking environment, so that the CPU
generates more heat.
Network Operating System
An Operating system, which includes software and associated
protocols to communicate with other computers via a network
conveniently and cost-effectively is called Network Operating
System.
Advantages:
 In this type of operating system, network traffic reduces due
to the division between clients and the server.
 This type of system is less expensive to set up and maintain.
Disadvantages :
 In this type of operating system, the failure of any node in a
system affects the whole system.
 Security and performance are important issues. So trained
network administrators are required for network
administration.
Real Time Operating System
In Real-Time Systems, each job carries a certain deadline within
which the job is supposed to be completed otherwise, the huge
loss will be there or even if the result is produced, it will be
completely useless.
Advantages:
• Easy to layout, develop and execute real-time applications
under the real-time operating system.
• In a Real-time operating system, the maximum utilization of
devices and systems.
Disadvantages:
• Real-time operating systems are very costly to develop.
• Real-time operating systems are very complex and can
consume critical CPU cycles.
Time Sharing Operating System
In the Time Sharing operating system, computer resources are
allocated in a time-dependent fashion to several programs
simultaneously. So the CPU is switched among multiple programs
given by different users on a scheduled basis.
Advantages:
• The time-sharing operating system provides effective utilization
and sharing of resources.
• This system reduces CPU idle and response time.
Disadvantages:
• Data transmission rates are very high in comparison to other
methods.
• Security and integrity of user programs loaded in memory and
data need to be maintained as many users access the system at
the same time.
Distributed Operating system
The Distributed Operating system is not installed on a single
machine, it is divided into parts and these parts are loaded on
different machines. A part of the distributed Operating system is
installed on each machine to make their communication
possible.
Distributed Operating systems are much more complex, large,
and sophisticated than Network operating systems because they
also have to take care of varying networking protocols.
Advantages:
• The distributed operating system provides sharing of
resources.
• This type of system is fault-tolerant.
Disadvantages:
Protocol overhead can dominate computation cost.
Buffering
The buffer is an area in the main memory used to store or
hold the data temporarily.

The act of storing data temporarily in the buffer is


called buffering.

A buffer may be used when moving data between


processes within a computer. Buffers can be implemented
in a fixed memory location in hardware or by using a
virtual data buffer in software, pointing at a location in the
physical memory.
Why do we need Buffer?

 It helps in matching speed between two devices in which the data


is transmitted.

 It helps the devices with different sizes of data transfer to get


adapted to each other.
1. Single Buffer
In Single Buffering, only one buffer is used to transfer the data
between two devices.
The producer produces one block of data into the buffer.
After that, the consumer consumes the buffer. Only when the
buffer is empty, the processor again produces the data.
2. Double Buffer
In Double Buffering, two schemes or two buffers are used in the
place of one.
In this buffering, the producer produces one buffer while the
consumer consumes another buffer simultaneously. So, the
producer no needs to wait for filling the buffer. Double buffering
is also known as buffer swapping.
3. Circular Buffer
Here more than two buffers are used, so that the buffers collection
is called a circular buffer.
Each buffer is being one unit in the circular buffer. The data transfer
rate will increase using the circular buffer rather than the double
buffering.
Working of Buffer:
Advantages of Buffer:
• The use of buffers allows uniform disk access. It simplifies
system design.

• The use of the buffer can reduce the amount of disk traffic,
thereby increasing overall system throughput and decreasing
response time.

• The buffer algorithms help ensure file system integrity.


Disadvantages:
• It is costly and impractical to have the buffer be the exact size
required to hold the number of elements. Thus, the buffer is
slightly larger most of the time with the rest of the space being
wasted.

• Use of the buffer requires an extra data copy when reading and
writing to and from user processes. When transmitting large
amounts of data, the extra copy slows down performance.
Spooling
 Spooling is a process in which data is temporarily held to
be used and executed by a device, program or system.

 SPOOL is an acronym for simultaneous peripheral


operations online

 Generally, the spool is maintained on the computer's


physical memory, buffers or the I/O device-specific
interrupts.

 The spool is processed in ascending order, working based


on a FIFO (first-in, first-out) algorithm.
SPOOLING WORKING
Advantages
• Many I/O devices can work together simultaneously without any
interference or disruption to each other.

• In spooling, the CPU is kept busy most of the time and only goes
to the idle state when the queue is exhausted. So, all the tasks are
added to the queue and the CPU will finish all those tasks and then
get into the idle state.

• It allows applications to run at the speed of the CPU while


operating the I/O devices at their respective full speeds.
Disadvantages:
• The SPOOL is created in the secondary storage, having many
input devices working simultaneously may take up a lot of space
on the secondary storage and thus increase disk traffic. This results
in the disk getting slower and slower as the traffic increases.
Terms Spooling Buffering
Definition Spooling, an acronym of Simultaneous Buffering is an act of storing data temporarily in
Peripheral Operation Online (SPOOL), puts the buffer. It helps in matching the speed of the
data into a temporary working area to be data stream between the sender and receiver.
accessed and processed by another program
or resource.

Resource Spooling requires less resource management Buffering requires more resource management
requirement as different resources manage the process for as the same resource manages the process of the
specific jobs. same divided job.

Internal Spooling overlaps the input and output of Buffering overlaps the input and output of one
implementation one job with the computation of another job. job with the computation of the same job.

Efficient Spooling is more efficient than buffering. Buffering is less efficient than spooling.

Processor Spooling can also process data at remote Buffering does not support remote processing.
sites. The spooler only has to notify when a
process gets completed at the remote site to
spool the next process to the remote side
device.

Size on memory It considers the disk as a huge spool or Buffer is a limited area in the main memory.
buffer.
OS Services
The user program requests various resources through the
operating system. The operating system gives several services to
utility programmers and users. Applications access these services
through application programming interfaces or system calls. The
different services are

Program execution
• To execute a program, several tasks need to be performed.
Both the instructions and data must be loaded into the main
memory. In addition, input-output devices and files should be
initialized and other resources must be prepared.
• Control Input/output devices
As there are numerous types of I/O devices within the computer system and
each I/O device calls for its own precise set of instructions for the operation.
The Operating System hides that info with the aid of presenting a uniform
interface. Thus, it is convenient for programmers to access such devices
easily.

• Program Creation
The Operating system offers the structures and tools, including editors and
debuggers to help the programmer create, modify and debugging programs.

• Error Detection and Response


An Error in a device may also cause malfunctioning of the entire device.
These include hardware and software errors such as device failure, memory
error, division by zero, attempts to access forbidden memory locations, etc.
To avoid error, the operating system monitors the system for detecting errors
and takes suitable action with at least impact on running applications.
Accounting
An Operating device collects utilization records for numerous assets and
tracks the overall performance parameters and responsive time to enhance
overall performance. These personal records are beneficial for additional
upgrades and tuning the device to enhance overall performance.

Security and Protection


Operating device affords safety to the statistics and packages of a person
and protects any interference from unauthorized users.

File management
• Computers keep data and information on secondary storage devices like
magnetic tape, magnetic disk, optical disk, etc. Each storage media has
its capabilities like speed, capacity, data transfer rate and data access
methods.
• For file management, the operating system must know the types of
different files and the characteristics of different storage devices. It has to
offer the proportion and safety mechanism of documents additionally.
Communication
The operating system manages the exchange of data and programs
among different computers connected over a network. This
communication is accomplished using message passing and shared
memory.
System calls
• 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. OR
• A system call is a request from computer software to an operating
system's kernel.

• A system call is a method of interacting with the operating system via


programs.

• The Application Program Interface (API) connects the operating


system's functions to user programs. It acts as a link between the
operating system and a process, allowing user-level programs to
request operating system services. System calls are required for any
programs that use resources.
Need for system calls in Operating System
• It is must require when a file system wants to create or
delete a file.

• Network connections require the system calls to sending and


receiving data packets.

• If you want to read or write a file, you need a system calls.

• If you want to access hardware devices, including a printer,


scanner, you need a system call.

• System calls are used to create and manage new processes.


Process Control
Process control is the system call that is used to direct the processes.
Some process control examples include creating, load, abort, end,
execute, process, terminate the process, etc.

File Management
File management is a system call that is used to handle the files.
Some file management examples include creating files, delete files,
open, close, read, write, etc.

Device Management
Device management is a system call that is used to deal with devices.
Some examples of device management include read device, write
device, get device attributes, release device, etc.
Information Maintenance
Information maintenance is a system call that is used to
maintain information. There are some examples of information
maintenance, including getting system data, set time or date,
get time or date, set system data, etc.

Communication
Communication is a system call that is used for communication.
some examples of communication are create, delete
communication connections, send, receive messages, etc.
Examples of Windows and Unix system calls
Process Windows Unix

Process Control CreateProcess() Fork()


ExitProcess() Exit()
WaitForSingleObject() Wait()
File Manipulation CreateFile() Open()
ReadFile() Read()
WriteFile() Write()
CloseHandle() Close()
Device Management SetConsoleMode() Ioctl()
ReadConsole() Read()
WriteConsole() Write()
Information Maintenance GetCurrentProcessID() Getpid()
SetTimer() Alarm()
Sleep() Sleep()
Communication CreatePipe() Pipe()
CreateFileMapping() Shmget()
MapViewOfFile() Mmap()
Protection SetFileSecurity() Chmod()
InitializeSecurityDescriptor() Umask()
SetSecurityDescriptorgroup() Chown()
Operating System Structure
Every segment is also a part of the operating system.
Operating system structure can be thought of as the strategy
for connecting and incorporating various operating system
components within the kernel.

SIMPLE STRUCTURE
It is the most straightforward operating system structure, but it
lacks definition and is only appropriate for usage with tiny and
restricted systems.
Since the interfaces and degrees of functionality in this structure
are clearly defined, programs are able to access I/O routines,
which may result in unauthorized access to I/O procedures.
This organizational structure is used by the MS-DOS operating
system:
• There are four layers that make up the MS-DOS operating
system and each has its own set of features.
• These layers include ROM BIOS device drivers, MS-DOS device
drivers, application programs and system programs.
• The MS-DOS operating system benefits from layering because
each level can be defined independently and when necessary
can interact with one another.
• If the system is built in layers, it will be simpler to design,
manage and update. Because of this, simple structures can be
used to build constrained systems that are less complex.
• When a user program fails, the operating system as whole
crashes.
• Because MS-DOS systems have a low level of abstraction,
programs and I/O procedures are visible to end users, giving
them the potential for unwanted access.
Advantages of Simple Structure:
• Because of few interfaces and levels, it is simple to develop.
• Because of fewer layers between the hardware and the
applications, it offers superior performance.

Disadvantages of Simple Structure:


• The entire operating system breaks if just one user program
malfunctions.
• Since the layers are interconnected and in communication with
one another, there is no abstraction or data hiding.
MONOLITHIC STRUCTURE
The monolithic operating system controls all aspects of the
operating system's operation including file management,
memory management and device management etc.
 The core of an operating system for computers is called the
kernel (OS). All other System components are provided with
fundamental services by the kernel. The operating system and
the hardware use it as their main interface.
 When an operating system is built into a single piece of
hardware, such as a keyboard or mouse, the kernel can directly
access all of its resources.
 The monolithic operating system is often referred to as the
monolithic kernel. Multiple programming techniques such as
batch processing and time-sharing increase a processor's
usability. Working on top of the operating system and under
complete command of all hardware, the monolithic kernel
performs the role of a virtual computer.
Advantages of Monolithic Structure:
 Because layering is unnecessary and the kernel alone is responsible
for managing all operations, it is easy to design and execute.
 Due to the fact that functions like memory management, file
management, process scheduling, etc., are implemented in the
same address area, the monolithic kernel runs rather quickly when
compared to other systems. Utilizing the same address speeds up
and reduces the time required for address allocation for new
processes.

Disadvantages of Monolithic Structure:


 The monolithic kernel's services are interconnected in address space
and have an impact on one another, so if any of them malfunctions,
the entire system does as well.
 It is not adaptable. Therefore, launching a new service is difficult.
LAYERED STRUCTURE
The OS is separated into layers or levels in this kind of
arrangement.
Layer 0 (the lowest layer) contains the hardware
layer 1 (the highest layer) contains the user interface and
(layer N). These layers are organized hierarchically with the
top-level layers making use of the capabilities of the lower-level
ones.
The functionalities of each layer are separated in this method,
and abstraction is also an option.
Because layered structures are hierarchical, debugging is
simpler, therefore all lower-level layers are debugged before the
upper layer is examined.
As a result, the present layer alone has to be reviewed since all
the lower layers have already been examined.
Advantages of Layered Structure:
• Work duties are separated since each layer has its own
functionality and there is some amount of abstraction.
• Debugging is simpler because the lower layers are examined first
followed by the top layers.

Disadvantages of Layered Structure:


• Performance is compromised in layered structures due to
layering.
• Construction of the layers requires careful design because upper
layers only make use of lower layers' capabilities.
Components of OS
There are various components of an Operating System to perform
well defined tasks. Each component must be a well-defined
portion of a system that appropriately describes the functions,
inputs and outputs.
There are 8-components in an Operating System:
Process Management
A program in running state is called a process. Or A process
is program or a fraction of a program that is loaded in main
memory.
A process needs certain resources including CPU time,
Memory, Files and I/O devices to accomplish its task. The process
management component manages the multiple processes
running simultaneously on the Operating System.
The operating system is responsible for the following activities in
connection with process management:
Create, load, execute, suspend, resume, and terminate
processes.
Switch system among multiple processes in main memory.
Provides communication mechanisms so that processes can
communicate with each others
Provides synchronization mechanisms to control concurrent
access to shared data to keep shared data consistent.
Allocate/de-allocate resources properly to prevent or avoid
deadlock situation.
I/O Device Management
I/O Device Management provides an abstract level of H/W devices
and keep the details from applications to ensure proper use of
devices to prevent errors and to provide users with convenient and
efficient programming environment.
Following are the tasks of I/O Device Management component:
• Hide the details of H/W devices
• Manage main memory for the devices using cache, buffer and
spooling
• Maintain and provide custom drivers for each device.
File Management
• File management is one of the most visible services of an
operating system. Computers can store information in several
different physical forms; magnetic tape, disk and drum are the
most common forms.
• A file is defined as a set of correlated information and it is defined
by the creator of the file. Data files can be of any type like
alphabetic, numeric, and alphanumeric.
Files is a sequence of bits, bytes, lines or records whose meaning is
defined by its creator and user.
The operating system is responsible for the following activities in
connection with file management:
• File creation and deletion
• Directory creation and deletion
• The support of primitives for manipulating files and directories
• Mapping files onto secondary storage
• File backup on stable (nonvolatile) storage media
Network Management
• Network management is the process of managing and
administering a computer network. A computer network is a
collection of various types of computers connected with each other.
• Network management comprises fault analysis, maintaining the
quality of service, provisioning of networks and performance
management.
Following are the features of network management:
• Network administration
• Network maintenance
• Network operation
• Network provisioning
• Network security
Memory Management
• Memory is a large array of words or bytes, each with its own
address. It is a repository of quickly accessible data shared by the
CPU and I/O devices.
• Main memory is a volatile storage device which means it loses its
contents in the case of system failure or as soon as system power
goes down.
• The operating system is responsible for the following activities in
connections with memory management:
• Keep track of which parts of memory are currently being used
and by whom.
• Decide which processes to load when memory space becomes
available.
• Allocate and deallocate memory space as needed.
Security Management
The operating system is primarily responsible for all task and
activities happen in the computer system. The various processes in
an operating system must be protected from each other’s
activities.
Security Management refers to a mechanism for controlling the
access of programs, processes or users to the resources defined by
a computer controls to be imposed, together with some means of
enforcement.
Open Source Operating System:
“Open source" refers to computer software or applications
where the owners or copyright holders enable the users or third
parties to use, see and edit the product's source code. The
source code of an open-source OS is publicly visible and
editable.
Some basic examples of the open-source operating
systems are Linux, Open Solaris, Free RTOS, Open BDS,
Free BSD, Minix, etc.

1. Linux Kernel
 Linux kernel was developed by Linus Torvalds. It offers the essential
functions required for an operating system such as data cancellation,
memory processing and interactions with computer hardware.
 It is open-source software and many developers researched the source
code and produced a plethora of helpful plug-ins and operating systems to
meet their requirements.

2. Fedora
Fedora is another popular Linux-based operating system and it is
widely considered the best open-source operating system after
Ubuntu.
It is an RPM-based general-purpose operating system that is
supported by Red Hat and built by the Fedora Project community.
 Its purpose is to develop and share cutting-edge open-source
technology for free. Fedora developers' updates are available to
all Linux distributions.
Fedora comes with a customizable GNOME-based desktop. Its
Fedora Spins feature allows you to customize and run several user
interfaces and desktop environments.
3.Chrome OS
Chrome OS is a partly open-source operating system with
various attractive features.
It's a part of the Chromium and Linux families, with features
including better security, compatibility for supported Android
and Chrome apps, Aura windows manager, Google cloud
print, integrated media player, virtual desktop access, and
cloud-based management.
The only issue with the operating system is that it only
supports Nexus devices or its hardware.
Advantages
1. Reliable and efficient
The open-source operating systems are most reliable and
efficient. Thousands of eyes monitor these because the source
code is public. As a result, if there are any bugs or errors, they
are fixed by the best developers worldwide.

2. Cost-efficient
Most of the open-source operating systems are free. And some
of them are far less expensive than commercially closed
products.

3. Flexibility
The great advantage is you may customize it as per your
requirement.
Disadvantages
1. Complicated
It is not as user-friendly as the ones that are closed. To use this
software, you must have a basic understanding of technology.

2.Security risk
Despite the defects having been detected, there is a risk of assaults
because the attackers have access to the source code.

3. No support
If you run across an issue, there is no customer support available to
assist you.

You might also like