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

OPERATING SYSTEM

PCC CS 502

P.R@CSE,HIT 1
P.R@CSE,HIT 2
Examples of Operating System
 Windows
https://en.wikipedia.org/wiki
 Android
/List_of_operating_systems
 iOS
 Mac OS
 Linux
 Window Phone OS
 Chrome OS

P.R@CSE,HIT 3
Introduction
An Operating System is a set of programs, which control
all the computer resources and provide an environment
in which, a user can develop application programs.
It is an intermediary between, a user and the computer
hardware.
The exact placement of OS shown in the figure (next
slide).

P.R@CSE,HIT 4
Structure of a Computer System
 Users (people who are using the
computer)
 Application Programs (MS Word,
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)

P.R@CSE,HIT 5
An OS runs on a computer hardware and serves as a
platform for others software's to run on the computer
system.
An OS is a program (system software) which acts as an
interface between the user and computer hardware.

A computer system can logically divided into three


components.

P.R@CSE,HIT 6
Logical
Computer
Hierarchy

P.R@CSE,HIT 7
User View

P.R@CSE,HIT 8
 The user’s view of the computer varies according to the
interface being used.
 Many computer users sit with a laptop or in front of a PC
consisting of a monitor, keyboard, and mouse.
 Many users interact with mobile devices such as
smartphones and tablets.
 Many mobile devices also allow users to interact through a
voice recognition interface, such as Apple’s Siri.
 Some computers have little or no user view. For example,
embedded computers in home devices and automobiles
P.R@CSE,HIT 9
System View
 From the computer’s point of view, the operating system is the program
most intimately involved with the hardware.
 In this context, we can view an operating system as a resource
allocator.
 Resources: CPU time, memory space, storage space, I/O devices etc.
 A slightly different view of an operating system emphasizes the need to
control the various I/O devices and user programs.
 An operating system is a control program. A control program manages
the execution of user programs to prevent errors and improper use of
the computer.
 It is especially concerned with the operation and control of I/O devices.
P.R@CSE,HIT 10
A more common definition, and the one that we usually
follow, is that the operating system is the one program
running at all times on the computer—usually called the
Kernel.
Along with the kernel, there are two other types of
programs: System programs, which are associated with
the operating system but are not necessarily part of the
kernel, and application programs, which include all
programs not associated with the operation of the
system.
P.R@CSE,HIT 11
System View

P.R@CSE,HIT 12
WHAT IS AN OPERATING SYSTEM?
An operating system (OS) is a layer of
software on a bare hardware machine that
performs two basic functions :
(a) Resource Management.
(b) Virtual machine management
(User friendliness).

P.R@CSE,HIT 13
P.R@CSE,HIT 14
Resource management
A user-process accesses several hardware and
software resources during its execution.
Examples of resources are CPU, Main Memory,
input-output devices and various types of
software resources such as compiler, linker,
loader, files etc.
OS manages the resources and allocates them to
users in an efficient and fair manner.
P.R@CSE,HIT 15
Resource management encompasses the following:
 (a) Time management (CPU, DISK
Scheduling)
 (b) Space management (Main Memory
& Secondary Memory).
 (c) Process synchronization and
deadlock handling.
 (d) Status Information.

P.R@CSE,HIT 16
Virtual Machine Management
An operating system (OS) hides the unpleasant, low-
level details of a bare hardware machine and provides
users with a much friendlier interface to the machine.

To load, manipulate, print and execute programs, high


level commands can be used without the
inconvenience of worrying about low-level details.

P.R@CSE,HIT 17
The layer of an operating system transforms a
bare hardware machine into a virtual machine
with added functionality (such as automatic
resource management).
Moreover, the user of the virtual machine have
the illusion that each one of them is the sole user
of the machine, even though the machine may
be operating in a multi-user environment.

P.R@CSE,HIT 18
The virtual machine management encompasses the
following tasks:
(a) Execution Environment: It includes process creation
and management, control, and termination, file
manipulation, interrupt handling, support for I/O
operations, language support.
(b) Error detection and handling.
(c) Protection and security.

P.R@CSE,HIT 19
P.R@CSE,HIT 20
So, we can say that an OS is a Resource
Manager as well as a virtual Machine Manager.

Do we need an OS all time?

P.R@CSE,HIT 21
It is not essential to have an OS to use a
computer. Some special purpose computer do
not have an OS.
 For example: Almost all microwave ovens,
washing m/c have a small computer chip
inside to control the oven.
Embedded System

P.R@CSE,HIT 22
The OS implements many necessary features
that are used by almost every program.

It is a good investment to implement them


once in OS rather than in each application
program.

P.R@CSE,HIT 23
As we know that a general purpose computer
must be able to run a wide range of programs.
For such a system, an OS is the most natural
way to go. Otherwise, each application would
have to program its own operating system
services.
Thus, we conclude that for a general purpose
computer system, it is essential to have an OS.
P.R@CSE,HIT 24
• How to interact with OS?

P.R@CSE,HIT 25
 There are two ways in which one can interact with an OS-
(a) By means of operating system call in a program.
(b) Directly by means of operating system Commands.
 OS calls are like our system calls or predefined functions or
subroutine calls.
 A system call is the programmatic way in which a computer
program requests a service from the kernel of the operating
system on which it is executed.
 On the other hand, OS commands are the commands that are
directly run from the prompt. For example, to list files or sub-
directories in MS-DOS, we use dir command.
P.R@CSE,HIT 26
History of OS

P.R@CSE,HIT 27
P.R@CSE,HIT 28
MAJOR GOALS OF OPERATING SYSTEMS
Any operating system should meet the following major goals
 (a) optimize the use of computer resources so as to maximize its
throughput.
 (b) create a user-friendly computing environment for accessing
the computer resources.
 (c) An operating system is a control program which manages the
execution of user programs to prevent errors and improper use
of the computer. It also controls the I/O.

P.R@CSE,HIT 29
How OS Starts??

P.R@CSE,HIT 30
1. Power Up. The first step of any boot process
is applying power to the machine.
2. Power-On Self Test. The next step in the boot
process is called the POST, or power on self
test.
3. Find a Boot Device.
4. Load the Operating System.
5. Transfer Control.
P.R@CSE,HIT 31
When the power of a computer is turned on, the first
program that runs is usually a set of instructions stored
in Read-only Memory (ROM) that examines the system
hardware to check whether all our hardware device
function properly or not. (BIOS)

This will check our CPU, Memory, basic I/O for errors
and stores the result in a special memory location. This
is known as power-on-self test (POST).

P.R@CSE,HIT 32
Once the POST (power on self test) has
successfully completed, the software loaded
in ROM will begin to activate the disk drives in
our computer.

When the computer activates the hard disk


drive then the first piece of a system program
it finds is the bootstrap loader.
P.R@CSE,HIT 33
What is a bootstrap loader?
 The bootstrap loader is a small program whose single function is
to load the OS into the memory and allows it to begin
operation.
 It sets up the divisions of memory that holds the OS user
information and applications.
 It establishes the data structures that will hold the signals, flags
and semaphores that are used to communicate between the
subsystems and applications of the computer.
 Finally, it turns control of computer over to the OS.

P.R@CSE,HIT 34
Steps of Booting DOS:
1. computer BIOS(Basic Input Output System) runs self-
tests.
2. If no problems, BIOS tries to boot an operating
system from a drive. Older computers usually try a:
drive first, c: drive second. Newer computers have a
BIOS setting to tell BIOS where to look first, usually c:.
3. BIOS looks for boot-up files (Master Boot
Record;MBR, HD0) (usually on drive c:)

P.R@CSE,HIT 35
4. most common boot-up files are the
Microsoft boot-up files: io.sys, msdos.sys, and
command.com
5. next, DOS looks for config.sys file and loads
drivers line by line.
6. next, DOS looks for autoexec.bat file and
executes DOS commands or runs given
programs line by line.
P.R@CSE,HIT 36
OS services
Therefore, the main OS services are as follows
 To control basic Input and Output.
 To allocate system Resources.
 To detect equipment failure.
 To manage storage space.
 To maintain security.
 Utilities.
P.R@CSE,HIT 37
Kernel in Operating System
• Kernel is central component of an operating system
that manages operations of computer and hardware.
• It basically manages operations of memory and CPU
time.
• It is core component of an operating system.
• Kernel acts as a bridge between applications and data
processing performed at hardware level using inter-
process communication and system calls.
P.R@CSE,HIT 38
• Kernel loads first into memory when an operating system is
loaded and remains into memory until operating system is shut
down again.
• It is responsible for various tasks such as disk management, task
management, and memory management.
• It decides which process should be allocated to processor to
execute and which process should be kept in main memory to
execute.
• It basically acts as an interface between user applications and
hardware.
• The major aim of kernel is to manage communication between
software i.e. user-level applications and hardware i.e., CPU and
disk memory. P.R@CSE,HIT 39
Objectives of Kernel
 To establish communication between user level
application and hardware.
 To decide state of incoming processes.
 To control disk management.
 To control memory management.
 To control task management.

P.R@CSE,HIT 40
There are two types of kernels:
A micro kernel, which only contains basic functionality.
 Unix, Linux, Open VMS, XTS-400 etc.
A monolithic kernel, which contains many device drivers.
 Mach, L4, AmigaOS, Minix, K42 etc.
A computer user never interacts directly with the kernel.
It runs behind the scenes and cannot be seen, except for
the text logs that it prints.

P.R@CSE,HIT 41
Types of Operating System
 Batch Operating System
 Time-Sharing Operating System
 Embedded Operating System
 Multiprogramming Operating System
 Network Operating System
 Distributed Operating System
 Multiprocessing Operating System
 Real-Time Operating System

P.R@CSE,HIT 42
THE EVOLUTION OF OPERATING SYSTEMS
 An operating system may process its task serially (sequentially) or
concurrently (several tasks simultaneously).
 This means that the resources of the computer system may be
dedicated to a single program until its completion or they may be
allocated among several programs in different stages of
execution.
 This feature of an OS to execute multiple programs in interleaved
fashion or different time cycles is know as multiprogramming.

P.R@CSE,HIT 43
Serial Processing
 In serial processing, the programs were executed strictly in a serial manner one after
another.
 The source code (program) written in assembly or high level language on a pack of
punched cards could be entered into the computer using punch card reader.
 Then, the assembler or compiler used to be loaded to translate the source code into an
object file.
 Then the object file used to be linked with library routines to create an executable file,
which was then executed and the results were displayed.
 It is only after this that the next program was taken up for execution in a strictly serial
manner.

I/O I/O I/O


JOB1 JOB2 JOB3
JOB1
CPU JOB1
CPU JOB1
CPU idle
CPU CPU idle CPU
idle idle P.R@CSE,HIT 44
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.

P.R@CSE,HIT 45
There are two other approaches of improving
the system performance by overlapping input,
output and processing. They are as follows

(a) Buffering
(b) Spooling.

P.R@CSE,HIT 46
Buffering
 It is a method of overlapping input, output and
processing of a single job.
The idea is quite simple. After data has been
read and the CPU is about to start operating on
it, the input device is instructed to begin the next
input immediately.

P.R@CSE,HIT 47
SPOOLING
 It stands for Simultaneous Peripheral Operation Online.
 'Simultaneous' means, say if two or more users issue the print
command and the printer can accept the requests even if it is
printing some other job.
 It is a kind of buffering mechanism or a process in which data is
temporarily held to be used and executed by a device, program or
the system.
 In computer science, spool refers to the process of placing data in
a temporary working area for another program to process.

P.R@CSE,HIT 48
• The most common can be found in I/O devices like
keyboard printers and mouse.
• For example, in printer, the documents/files that are
sent to the printer are first stored in the memory or the
printer spooler.
• Once the printer is ready, it fetches the data from the
spool and prints it.

P.R@CSE,HIT 49
Multiprogramming
Multiprogramming is a technique to execute number of
programs simultaneously by a single processor.
Buffering and spooling improve system performance by
over lapping the input, output and computation of a
single job, but both have their limitations.
A single user cannot always keep CPU or I/O devices
busy at all times.

P.R@CSE,HIT 50
So, multiprogramming offers a more efficient approach
to increase the system performance.
To increase the resource utilization, the systems
supporting this multiprogramming approach, allow
more than one job (program) to utilize CPU time at any
moment.
Please note here that more the number of programs
competing for system resources better will be the
resource utilization.

P.R@CSE,HIT 51
The basic idea
The main memory of the
system contains more than one
program as shown in Fig.
The OS could support for
keeping several jobs in the
memory at one time.
The OS could pick and start the
execution of one of the jobs in
the memory. We can use a monitor to achieve mutual
exclusion among the processes
P.R@CSE,HIT 52
Whenever the jobs does not need CPU (i.e.
the job has to do I/O only) and so the CPU is
idle at that time, then the OS switches to
another job in the memory and CPU executes
a portion of it till this job issues a request for
I/O or the first one has finished its I/O and so
on.
P.R@CSE,HIT 53
P.R@CSE,HIT 54
Advantages of Multiprogramming
1. High CPU utilization as it is never idle.
2. Supports multiple simultaneous interactive
user (terminals).
3. Efficient memory utilization.
4. More CPU throughput.

P.R@CSE,HIT 55
Disadvantages of Multiprogramming
1. Jobs may have different sizes, so some powerful
memory management policy is desired to
accommodate them in memory.
2. CPU scheduling is must because now many jobs are
ready to be run on the cpu.
3. The user cannot interact with the job when it is being
executed.
4. The programmer cannot modify a program to study its
behavior while the program is being executed.
P.R@CSE,HIT 56
Multiprogramming Operating system
 There are three different forms of multiprogramming operating
system
(a) Multitasking/Time sharing OS.
(b) Multiuser OS. Multiprogramming – A computer running more
(c) Multiprocessing OS. than one program at a time (like running Excel
and Firefox simultaneously).
Multiprocessing – A computer using more than
one CPU at a time.
Multitasking – Tasks sharing a common
resource (like 1 CPU).
Multithreading -- is an extension of multitasking.

P.R@CSE,HIT 57
Time-Sharing Operating Systems
 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.

P.R@CSE,HIT 58
Multitasking is a logical extension of multiprogramming.
In multitasking systems, the CPU executes multiple
processes by switching among them, but the switches
occur frequently, providing the user with a fast response
time.
Consider that when a process executes, it typically
executes for only a short time before it either finishes or
needs to perform I/O.

P.R@CSE,HIT 59
A running state of a program is called a
process or a task.
A multitasking operating system
supports two or more active processes
simultaneously.

P.R@CSE,HIT 60
The simplest form of multitasking is called as serial
multitasking or Context switching.
It means that working on another task will lead to
temporary stoppage of first task.
For example, while a program is running, you decide
that you want to use the calculator, so you pop it and
use it.
When you stop using the calculator, the program
continues running even then. This is serial multitasking
example.
P.R@CSE,HIT 61
• Advantages of Time-Sharing OS:
– Each task gets an equal opportunity
– Fewer chances of duplication of software
– CPU idle time can be reduced
• Disadvantages of Time-Sharing OS:
– Reliability problem
– One must have to take care of the security and integrity of user
programs and data
– Data communication problem

P.R@CSE,HIT 62
Multi-user Operating system
It is defined as a multiprogramming OS that supports
simultaneous interaction with multiple users.
The multiuser support is necessary for the large
company where the data remains same among various
user.
The data is stored centrally in one computer called as
server and all the users can access this data through
the terminals called as client machines.
P.R@CSE,HIT 63
For example: A dedicated transaction processing
system such as a Railway Reservation system is an
example of a multiuser OS.

This system supports the hundreds of terminals under


the control of a single program.

P.R@CSE,HIT 64
General purpose Time sharing systems incorporate
the features of both multiuser and
multiprogramming OS.

Also note that multiuser OS does not imply


multiprogramming or multitasking.

P.R@CSE,HIT 65
Multiprocessing
 We know that there is a limit on the
speed with which a single CPU can
operate.
 If one CPU cannot handle a system's
work load then one possible solution is
to apply multiple processors to the
problem.
 This is called Multiprocessing
environment.

P.R@CSE,HIT 66
Parallel systems
 A system consisting of more than one processor that is tightly
coupled (i.e. heavy sharing of resources like bus, clock, memory,
I/O devices) is a Parallel system.
 A single CPU may be slow. So, a possible solution is to have many
CPUs but parallely to execute a single given problem. This is
parallel processing and such systems are also called as
Supercomputers.
 These Systems will increase the CPU throughput (number of jobs
per unit time), reduce time required for job execution.

P.R@CSE,HIT 67
Distributed systems
It comprises of a large central computer to
which a large number of remote terminals
are attached.
We consider two examples to show what is a
distributed system and hence distributed
processing.

P.R@CSE,HIT 68
Example 1: Print sharing
Consider that there are two sites, site-1 and
site-2. These two sites are connected by some
communication links and that the site-1 is
having a printer.
But site-2 doesn't have a printer. Then site-2
can use the printer at site-1 without moving
from site-2 to site-1, by resource sharing that is
possible in a distributed system.
P.R@CSE,HIT 69
Example 2: Bank
Consider a bank having its branches throughout India
and its head office is in Delhi. Also, we assume that
this bank maintains the local data at the local branch
and the Copy of data of all branches at Delhi.
Thus, we say that the data is distributed throughout
India. This eases query processing for local customers
of a branch and also for global customer.

P.R@CSE,HIT 70
 Distributed systems use multiple central processors to serve
multiple real-time applications and multiple users.
 Data processing jobs are distributed among the processors
accordingly.
 The processors communicate with one another through various
communication lines (such as high-speed buses or optical fiber
lines).
 These are referred as loosely coupled systems or distributed
systems.
 Processors in a distributed system may vary in size and function.
These processors are referred as sites, nodes, computers, and so
on.
P.R@CSE,HIT 71
Advantages of Distributed processing
 Load on host computer reduces.
 Failure of one will not affect the other network
communication, as all systems are independent from each
other.
 If a number of sites are connected by high speed
communication lines, then it allows us to do resource sharing
in a distributed system.
 There is a computation speed-up.
 Reliability of a distributed system is good.
P.R@CSE,HIT 72
Real Time systems
A real-time system is defined as a system in which the
correctness of computations depends not only on the
logical correctness of the computation but also on the
time at which the result is produced.
So, we can say that it has strict time constraints.
Sensors bring data to the computer . The input data or
outputs should be available within this time period
otherwise disasters can happen.
Examplels: PSOS, RT-Linux
P.R@CSE,HIT 73
The computer must analyze the data and
adjust controls to modify the sensor inputs.
For example, some real time systems are like
Air-traffic control, medical imaging systems,
industrial control systems etc.
Also included in this category are automobile-
engine fuel injection systems, home appliances
controllers and weapon systems.
P.R@CSE,HIT 74
P.R@CSE,HIT 75

You might also like