Os CH 1
Os CH 1
Os CH 1
Looping
• Computer system overview
• Computer system architecture
• What is Operating System (OS)
• Roles of Operating System (OS)
• Objectives / Goals of Operating System (OS)
• Generations of Operating Systems (OS)
• Operating Systems (OS) services
• Types of Operating Systems (OS)
• System calls
• Operating Systems (OS) structure
• Multiprogramming v/s Multiprocessing v/s
Multitasking
• Time Sharing Operating System
• Parallel Processing Operating System
• Distributed Operating System
Computer system overview
Section - 1
Basic elements of computer
I/O
Processor
Modules
System
Memory
Bus
Processor
Referred to as the
Central Processing
Unit (CPU)
Memory is device
that is used to store
data/information
• Volatile • Non-Volatile
• RAM & ROM • HDD, CD &
DVD
Exercise Give the difference between primary memory and secondary
memory.
I/O Module (Input/Output Module)
• Input/output module is a device that acts as the connective bridge between a
computer system at one end and an I/O or peripheral device at the other, such
as a printer, webcam or scanner.
An I/O module is a mediator
between the
processor/memory and an I/O
devices.
It controls the data exchange
between the external devices
and main memory or external
devices and CPU registers.
System Bus
• Provides communication among processors, main memory,
and I/O devices.
• The system bus is a pathway composed of cables and
connectors used to carry data between a computer
microprocessor and the main memory.
• Types of buses
• Address bus - carries memory addresses from the processor to other
components such as primary storage and input/output devices.
• Data bus - carries the data between the processor and other
components.
• Control bus - carries control signals from the processor to other
components.
Exercise What are the 3 types of buses?
Computer system architecture
Section - 2
Computer system architecture
Input unit
• It provides data and instructions
to the computer system.
• Commonly used input devices are
keyboard, mouse, magnetic tape etc.
• Input unit performs following tasks:
• Accept the data and instructions from
the outside environment.
• Convert it into machine language.
• Supply the converted data to computer
system.
Output unit
• It connects the internal system of
a computer to the external
environment.
• It provides the results of any
computation, or instructions to the
outside world.
• Some output devices are printers,
monitor etc.
Storage unit
• This unit holds the data and
instructions.
• It also stores the intermediate
results before these are sent to the
output devices.
• It also stores the data for later
use.
• The storage unit of a computer
system can be divided into two
categories:
• Primary Storage
• Secondary Storage
Primary storage (memory) vs Secondary storage (memory)
Primary storage Secondary storage
Examples: RAM, ROM, Cache memory, Examples: Hard Disk, Floppy Disk, Magnetic
PROM, EPROM, Registers, etc. Tapes, etc.
It is temporary and volatile. It is permanent and Non-volatile.
Primary memory is directly accessible by Secondary memory is not directly accessible
Processor/CPU. by the CPU.
Primary memory devices are expensive. Secondary memory devices are cheaper.
The memory devices used for primary The secondary memory devices are magnetic
memory are semiconductor memories. and optical memories.
Primary memory is also known as Main Secondary memory is also known as External
memory or Internal memory. memory or Auxiliary memory.
CPU (Central Processing Unit)
• The Arithmetic Logical Unit and
Control Unit are together known
as CPU.
• CPU is the brain of computer
system.
• It performs following tasks:
• performs all operations.
• takes all decisions.
• controls all the units of computer.
ALU (Arithmetic Logical Unit)
• All the calculations are performed
in ALU of the computer system.
• The ALU can perform basic
operations such as addition,
subtraction, division, multiplication
etc.
• Whenever calculations are required,
the control unit transfers the data
from storage unit to ALU.
• When the operations are done, the
result is transferred back to the
storage unit.
CU (Control Unit)
• It controls all other units of the
computer.
• It controls the flow of data and
instructions to and from the
storage unit to ALU.
• Thus it is also known as central
nervous system of the computer.
What is Operating System (OS)
Section - 3
What is Operating System (OS)?
• A Computer System consists of various hardware's such as
Examples
of
Operating
System
Where OS lies? (Interaction of OS & Hardware)
• OS lies between hardware and user
program.
• It acts as an intermediary between the Web E-mai Music
user and the hardware. browser l player
reader
• Modes of operation of computer
1. Kernel Mode User
• has complete access to all the hardware User Program
Mod
Software e
• can execute any instruction that a machine is
capable of executing Operating System
Kerne
• has high privileged (rights) l
Mode
2. User Mode Hardwar
• has limited access to limited hardware e
• can execute only subset (few) of the machine
instructions
• has less privileged (rights)
Why and How switch occur?
Operating System
Kerne ▪ To execute this program
l 1. Load program into RAM
Mode 2. Program is executed by processor
Hardwar
e
Roles of Operating System
(OS)
Section - 4
OS as Extended Machine
• The architecture of a computer is difficult to
program
• Architecture (instruction set, memory organization, I/O,
bus structure) of most of computer at the machine level
language is primitive and awkward to program.
• Example: If user want to read from floppy or hard
disk:
OS as Extended Machine
• Example: If user want to read from floppy or hard disk:
The disk controller will find the requested User has to check the status of disk
data in the disk and fetch it from disk to controller operation where it has
disk controller buffer. finished or not.
OS as Extended Machine
7+9–6*4/2=
P1 P2 P3 P4
4 20
3 4 1 2
OS as Resource Manager
• It is the job of OS to proper allocate these resources to the various
applications so that:
• Deadlock are detected, resolved and avoided.
OS as Resource Manager
• Resource manager – sharing resources in two different ways:
1. In time sharing/multiplexing (i.e CPU)
OS as Resource Manager
• Resource manager – sharing resources in two different ways
2. In space sharing/multiplexing. (i.e Memory)
Main Memory
Objectives / Goals of Operating
System (OS)
Section - 5
Objectives / Goals of Operating System (OS)
• Make the computer system convenient to use in an efficient manner.
• Hide the details of the hardware resources from the users.
• Provide users a convenient interface to use the computer system.
• Act as an intermediary between the hardware and its users, making it easier
for the users to access and use other resources.
• Manage the resources of a computer system.
• Keep track of who is using which resource, granting resource requests, and
mediating conflicting requests from different programs and users.
• Provide efficient and fair sharing of resources among users and programs.
Generations of Operating
Systems (OS)
Section - 6
Generations / History of OS (First generation)
• First generation (1945-1955)
• Vacuum tubes and plug-boards are used in these systems.
Vacuum tubes
Plug board
Generations / History of OS (Second generation)
• Second generation (1955-1965)
• Transistors are used in these systems
• The machine that are produced are called mainframes.
• Batch systems was used for processing.
Programmers bring
1401 reads
cards batch
to 1401
Operator
of jobs carries
onto tape
input
7094Operator
tape
doestocomputing
7094
carries output1401
tape prints
to 1401output
Generations / History of OS (Third generation)
• Third generation (1965-1980)
• Integrated circuits (IC's) are used in place of transistors in these computers.
• It provides multiprogramming (the ability to have several programs in memory at once,
each in its own memory partition).
Generations / History of OS (Forth generation)
• Fourth generation (1980-present)
• Personal Computers (PC)
• LSI (Large Scale Integration) circuits, chips containing thousands of transistors are used
in these systems.
Operating Systems (OS)
services
Section - 7
Services / Functions / Tasks of Operating System (OS)
P1
P2
Services / Functions / Tasks of Operating System (OS)
5. Controlled access to file
• In case of file access, OS provides a directory hierarchy
for easy access and management of file.
• OS provides various file handling commands using
which user can easily read, write and modify file.
Services / Functions / Tasks of Operating System (OS)
6. Communication
• In multitasking environment, the processes need to communicate with each other and to
exchange their information.
• Operating system performs the communication among various types of processes in the
form of shared memory.
Services / Functions / Tasks of Operating System (OS)
7. Error detection and response
• 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.
Services / Functions / Tasks of Operating System (OS)
8. Accounting
• Keeping a track of which users are using how much and what kinds of computer resources
can be used for accounting or simply for accumulating usage statistics.
• Usage statistics is used to reconfigure the system to improve computing services.
Services / Functions / Tasks of Operating System (OS)
9. Protection & Security
• Protection involves ensuring that all accesses to system resources is controlled.
• To make a system secure, the user needs to authenticate himself or herself to the system.
Types of Operating Systems
(OS)
Section - 8
Types of Operating Systems (OS)
1. Mainframe operating systems
• OS found in room sized computers which are still found in major corporate data centers.
• They offer three kinds of services:
1. Batch OS
2. Transaction processing
3. Timesharing
• Examples: OS/390, OS/360.
Mainframe Operating Systems services
Batch OS – processes routine jobs without any interactive user presents
i.e. claim processing in insurance
Transaction processing – handles large numbers of small
processes i.e. cheque processing at banks
• Virtual machine monitor run on the bare hardware and does the
multiprogramming.
• Each virtual machine is identical to the true hardware; each one can run any
OS (may be different) that will run directly on the bare hardware.
• On VM/370, some run OS/360 while the others run single user interactive
system called CMS (Conversational Monitor System) for interactive time
sharing users.
VM/370
• When CMS program executed a system call, a call was trapped to the operating
system in its own virtual machine, not on VM/370.
• CMS then issued the normal hardware I/O instruction for reading its virtual disk
or whatever was needed to carry out the call.
• These I/O instructions were trapped by VM/370 which then performs them.
Virtual Machines Rediscovered
• Companies can run their mail servers, web servers, FTP servers and other
servers on the same machine without having a crash of one server bring
down the rest.
• Web hosting company offers virtual machines for rent, where a single
physical machine can run many virtual machines; each one appears to be a
complete machine.
• Customers who rent a virtual machine can run any OS or software.
Virtual Machines Rediscovered
• Another use of virtualization is for end users who want to be able to run two
or more operating systems at the same time, say Windows and Linux.
• Type 1 hypervisors runs on the bare hardware.
• Type 2 hypervisors run as application programs on top of Windows, Linux,
or some other operating system, known as the host operating system.
Java Virtual Machine
• When Sun Microsystems invented the Java
programming language, it also invented a virtual
machine called the JVM (Java Virtual Machine).
• The Java compiler produces code for JVM,
which then typically is executed by a software
JVM interpreter.
• The advantage is that the JVM code can be
shipped over the internet to any computer that
has a JVM interpreter and run there.
Exokernels
• Rather than cloning (copying) the actual machine, another strategy is
partitioning it (giving each user a subset of the resource).
• For example one virtual machine might get disk blocks 0 to 1023, the next one
might get block 1024 to 2047, and so on.
• Program running at the bottom layer (kernel mode) is called the exokernel.
• Its job is to allocate resources to virtual machines and then continuously
check to make sure no machine is trying to use somebody else’s resources.
• The advantage of the exokernel scheme is that it saves a layer of mapping.
Multiprogramming v/s
Multiprocessing v/s
Multitasking
Section - 11
Multiprogramming v/s Multiprocessing v/s Multitasking
Multiprogramming Multiprocessing Multitasking
Multiprogramming v/s Multiprocessing v/s Multitasking
Multiprogramming Multiprocessing Multitasking
The concurrent residency of The availability of more than The execution of more than
more than one program in one processor per system, one task simultaneously is
the main memory is called which can execute several set called as multitasking.
as multiprogramming. of instructions in parallel is
called as multiprocessing
Number of processor: one Number of processor: more Number of processor: one
than one
One process is executed at More than one process can be One by one job is being
a time. executed at a time. executed at a time.
Multitasking is a logical extension of multi programming. The major way in
which multitasking differs from multi programming is that multi programming
works solely on the concept of context switching whereas multitasking is based
on time sharing alongside the concept of context switching.
Time Sharing Operating
System
Section - 12
Time Sharing Operating System
• A time sharing operating system allows many users
to share the computer resources simultaneously.
• In other words, time sharing refers to the allocation of
computer resources in time slots to several
programs simultaneously.
• For example a mainframe computer that has many
users logged on to it.
• Each user uses the resources of the mainframe i.e.
memory, CPU etc.
Parallel Processing Operating
System
Section - 13
Parallel Processing Operating System
• Parallel Processing Operating Systems are designed to Multiprocessing