Osv Chapter 1 PDF
Osv Chapter 1 PDF
Uni – 1 Introductiont
Prepared By:
I/O
Process Module
or s
Main Syste
Memor m
y Bus
PROF J.T.PATEL
3
2 PROF J.T.PATEL
Processor
Referred
Referredtotoas
as
thethe Central
Central
Processing
Processing
Unit (CPU)
Unit (CPU)
Arithmetic & Logic Unit Control Unit
Unit Unit
Performs the Controls the
data
data operation of
processing
processing the computer
functions
functions
PROF J.T.PATEL
4
2 PROF J.T.PATEL
Main memory
Volatile
• Contents of the memory is lost
when the computer is shut down
Referred to as primary memory or RAM.
PROF J.T.PATEL
5
2 PROF J.T.PATEL
I/O modules
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.
storage (e.g.
Moves hard
drive)
between
data the
computer
and external communication
environment s
s such as: equipment
terminal
s
PROF J.T.PATEL
6
2 PROF J.T.PATEL
System bus
Provides communication
among processors, main
memory,
and I/O modules.
PROF J.T.PATEL
7
2 PROF J.T.PATEL
Computer system
architecture
PROF J.T.PATEL
8
2 PROF J.T.PATEL
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.
PROF J.T.PATEL
9
2 PROF J.T.PATEL
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.
PROF J.T.PATEL
PROF J.T.PATEL
Storage unit (Memory
unit)
• This unit holds the data
and instructions.
• It store the
intermediat
als s befor
these
e
o are sentresult
to the output
e
devices. s
• It also stores the data
for later use.
• Th storage unit of a
compute
e syste can
divided
r intomtwo b
categories: e
1. Primary Storage
2. Secondary Storage
PROF J.T.PATEL
11
1 PROF J.T.PATEL
1
Primary
Storage
• This memory is used to
store the data which is
being currently executed.
• It is used for temporary
storage of data.
• The data is lost, when the
computer is switched off.
• RAM is used as primary
storage memory.
PROF J.T.PATEL
12
1 PROF J.T.PATEL
1
Secondary
Storage
• The secondary memory is
slower and cheaper than
primary memory.
• It is used for permanent
storage of data.
• Commonly used secondary
memory devices are hard
disk, CD etc.
PROF J.T.PATEL
13
1 PROF J.T.PATEL
1
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.
PROF J.T.PATEL
14
1 PROF J.T.PATEL
1
ALU (Arithmetic Logical
Unit)
• All the calculations
performed in ALU of are
computer system. the
• The ALU can perform
basic operations such as
addition, subtraction,
division, multiplication
• etc.
Whenever calculations
required, the contr ar
transfers ol e
storage
the unit to ALU.
data uni
• When the operations aret
done, the result frois
transferred back to the m
storage unit.
PROF J.T.PATEL
15
1 PROF J.T.PATEL
1
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.
PROF J.T.PATEL
16
1 PROF J.T.PATEL
1
What is Operating System
(OS)?
A Computer System consists of various hardwares
such as
PROF J.T.PATEL
18
1 PROF J.T.PATEL
1
Examples of Operating
System
Exampl
es of
Operatin
g
System
PROF J.T.PATEL
19
1 PROF J.T.PATEL
1
Where OS lies? (Interaction of OS & Hardware)
Web E- Musi
browse mail c
r reade playe
r r
Softwar User
e Program
Operating
System
Hardwar
e
OS lies between hardware and user program.
It acts as an intermediary between the
user and the hardware.
PROF J.T.PATEL
2 PROF J.T.PATEL
0
Modes of operation of computer
1. Kernel Mode
• has complete access to
all the hardware Web E- Musi
• can execute any browse mail c
r reade playe
instruction that a machine r r
is capable of
Use
• executing
has high privileged User
Mod
r
(rights) S/ e
2. User W Program
Kern
Mode
• can execute only Operating
el
System
(few subset of Mode
)
instructions the H/W
machine
• has less privileged
(rights)
21
2 PROF J.T.PATEL
1
Why and How switch occur?
22
2 PROF J.T.PATEL
1
Roles of OS (OS can be viewed as)
1. The OS as an Extended/Virtual Machine
2. The OS as a Resource Manager
23
2 PROF J.T.PATEL
1
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:
24
2 PROF J.T.PATEL
1
OS as Extended Machine
• Example: If user want to read from floppy or hard disk:
User has to write command and
address to the disk controller and
then initiate the I/O.
Disk Controller
25
2 PROF J.T.PATEL
1
OS as Extended Machine
• Example: If user want to read from floppy or hard
disk: disk controller will find the User has to check the
The
requested data in the disk and fetch it status of disk controller
from disk to disk controller buffer. operation where it has
finished or not.
26
2 PROF J.T.PATEL
1
OS as Extended Machine
• Example: If user want to read from floppy or hard
disk:
If success, the data from disk controller
buffer should be moved to main
memory (to the application buffer).
27
2 PROF J.T.PATEL
1
OS as Extended Machine
(Cont…)
If all the users will have to do these messy details:
• The program will be very difficult to write and quite long.
• The program will be hardware dependent.
User don’t want to be involved in programming of storage
devices.
Therefore, an OS provides a set of basic commands or
instructions to perform various operations such as read,
write, modify, save or close.
Dealing with these command is easier than directly dealing
with hardware.
Operating system hides the complexity of hardware and
present a beautiful interface to the users.
28
2 PROF J.T.PATEL
1
OS as Resource Manager
There are lots of resources in computer system
• CPU (Processor)
• Memory
• I/O devices such as hard disk, mouse, keyboard, printer,
scanner etc.
If a computer system is used by multiple applications (or
users), then they will compete for these resources.
29
2 PROF J.T.PATEL
1
OS as Resource Manager
It is the job of OS to allocate these resourcesto the
various applications so that:
• The resources are allocated fairly (equally)
P Wants to print 50
1 lines
After printing 10 lines of P1
P Wants to print 20
2 lines
After printing 20 lines of P1
P Wants to print 15
3 lines
P Wants to print 15
4 lines
PROF J.T.PATEL
3 PROF J.T.PATEL
0
OS as Resource
Manager
It is the job of OS to allocate these resourcesto the
various applications so that:
• The resources are protected from cross-access
P Wants to print 50
1 lines
After printing 10 lines of P1
P Wants to print 20
2 lines
After printing 20 lines of P1
P Wants to print 15
3 lines
P Wants to print 15
4 lines
PROF J.T.PATEL
31
3 PROF J.T.PATEL
1
OS as Resource Manager
It is the job of OS to allocate these resourcesto the
various applications so that:
• Access to the resources is
synchronized so that operations
are correct and consistent
• Example: If we write a program to calculate below in C
language
7 + 9 – 6 * 4 / 2 =24
P1 P2 P3 P4
3 4 1
2 0
PROF J.T.PATEL
32
3 PROF J.T.PATEL
1
OS as Resource Manager
It is the job of OS to allocate these resourcesto the
various applications so that:
• Deadlock are detected, resolved and avoided.
PROF J.T.PATEL
33
3 PROF J.T.PATEL
1
OS as Resource Manager (Cont…)
Resource manager – sharing resources in two different
ways:
1. In time sharing/multiplexing (i.e CPU)
PROF J.T.PATEL
34
3 PROF J.T.PATEL
1
OS as Resource Manager
(Cont…)
Resource manager – sharing resources in two different
ways
2. In space sharing/multiplexing. (i.e Memory)
PROF J.T.PATEL
35
3 PROF J.T.PATEL
1
Objectives / Goals of Operating System
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.
PROF J.T.PATEL
36
3 PROF J.T.PATEL
1
History of OS (First generation)
First generation (1945-1955)
• Vacuum tubes and plug-boards are used in these
systems.
Vacuum
tubes Plug
board
PROF J.T.PATEL
PROF J.T.PATEL
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.
PROF J.T.PATEL
PROF J.T.PATEL
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).
PROF J.T.PATEL
39
3 PROF J.T.PATEL
1
History of OS (Fourth
generation)
Fourth generation (1980-present)
• Personal Computers
• LSI (Large Scale Integration) circuits, chips containing
thousands of transistors are used in these systems.
PROF J.T.PATEL
4 PROF J.T.PATEL
0
Services / Functions / Tasks of
OS
Definition of Operating
System
An Operating System (OS) is a collection of
software that
• manages hardware resources
• provides various service to the users
PROF J.T.PATEL
PROF J.T.PATEL
Services / Functions / Tasks of OS
1. Program development
• It provides editors and debuggers to assist (help) the
programmer in creating programs.
PROF J.T.PATEL
Services / Functions / Tasks of
OS
3. Access to I/O devices (Resource allocation)
• A running program may require I/O, which may involve file or
an I/O device.
• For efficiency and protection, users cannot control I/O
devices directly.
• Therefore, the OS controls these I/O devices
and provides to program as per requirement.
PROF J.T.PATEL 44
Services / Functions / Tasks of OS
4. Memory management
• OS manages memory hierarchy.
• OS keeps the track of which part of memory area in use in
use and free memory.
• It allocates memory to program when they need it.
• It de-allocate the memory when the program finish
execution.
P
1
P
2
PROF J.T.PATEL
PROF J.T.PATEL
Services / Functions / Tasks of OS
(Revision)
1. Program development
2. Program execution
3. Access to I/O devices
4. Memory management
5. Controlled access to file
6. Communication
7. Error detection and
response
8. Accounting
9. Protection & Security
File management
create file, delete file
open, close file
read, write, reposition
get and set file attributes
Device management
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices
Types of System Calls (Cont.)
Information maintenance
get time or date, set time or date
get system data, set system data
get and set process, file, or device attributes
Communications
create, delete communication connection
send, receive messages if message passing model to host
name or process name
From client to server
Shared-memory model create and gain access to memory
regions
transfer status information
attach and detach remote devices
Types of System Calls (Cont.)
Protection
Control access to resources
Get and set permissions
Allow and deny user access
Examples of Windows and Unix System Calls
Standard C Library Example
Single-tasking
Shell invoked when system
booted
Simple method to run
program
No process created
Single memory space
Loads program into
memory, overwriting all
but the kernel
Program exit -> shell
reloaded At system startup running a program
Example: FreeBSD
Unix variant
Multitasking
User login -> invoke user’s choice of
shell
Shell executes fork() system call to
create process
Executes exec() to load program into
process
Shell waits for process to terminate or
continues with user commands
Process exits with:
code = 0 – no error
code > 0 – error code
System Programs
System programs provide a convenient environment for
program development and execution. They can be
divided into:
File manipulation
Status information sometimes stored in a File modification
Programming language support
Program loading and execution
Communications
Background services
Application programs
Most users’ view of the operation system is defined by
system programs, not the actual system calls
System Programs
Provide a convenient environment for program development
and execution
Some of them are simply user interfaces to system calls; others
are considerably more complex
File management - Create, delete, copy, rename, print,
dump, list, and generally manipulate files and directories
Status information
Some ask the system for info - date, time, amount of available
memory, disk space, number of users
Others provide detailed performance, logging, and debugging
information
Typically, these programs format and print the output to the
terminal or other output devices
Some systems implement a registry - used to store and
retrieve configuration information
System Programs (Cont.)
File modification
Text editors to create and modify files
Special commands to search contents of files or perform
transformations of the text
Programming-language support - Compilers,
assemblers, debuggers and interpreters sometimes
provided
Program loading and execution- Absolute loaders,
relocatable loaders, linkage editors, and overlay-loaders,
debugging systems for higher-level and machine language
Communications - Provide the mechanism for creating
virtual connections among processes, users, and computer
systems
Allow users to send messages to one another’s screens,
browse web pages, send electronic-mail messages, log in
remotely, transfer files from one machine to another
System Programs (Cont.)
Background Services
Launch at boot time
Some for system startup, then terminate
Some from system boot to shutdown
Provide facilities like disk checking, process scheduling, error
logging, printing
Run in user context not kernel context
Known as services, subsystems, daemons
Application programs
Don’t pertain to system
Run by users
Not typically considered part of OS
Launched by command line, mouse click, finger poke
Operating System Design and Implementation
Much variation
Early OSes in assembly language
Then system programming languages like Algol, PL/1
Now C, C++
Actually usually a mix of languages
Lowest levels in assembly
Main body in C
Systems programs in C, C++, scripting languages like PERL,
Python, shell scripts
More high-level language easier to port to other hardware
But slower
Emulation can allow an OS to run on non-native hardware
Types of OS
1. Mainframe operating systems
• OS found in room sized computers which are still found in
major corporate data centres.
• They offer three kinds of services:
1) Batch OS – processes routine jobs without any interactive
user
presents i.e. claim processing in insurance
2) Transaction processing – handles large numbers of small
processes i.e. cheque processing at banks
PROF J.T.PATEL
1 PROF J.T.PATEL
Types of
OS
1. Mainframe operating systems
• OS found in room sized computers which are still found in
major corporate data centres.
• They offer three kinds of services:
1) Batch OS – processes routine jobs without any
interactive user presents i.e. claim processing in insurance
2) Transaction processing –
handles large numbers of small
processes i.e. cheque processing at banks
3) Timesharing – allows multiple remote users to run
their jobs at once i.e. querying a database, airline booking
system
• Examples: OS/390, OS/360.
•multiprocessor.
• It is also called parallel computers, multicomputer
or multiprocessor.
• They need special OS or some variations on server OS with
special features for communication, connectivity and
consistency.
• Examples: Windows and Linux.
PROF J.T.PATEL
555 PROF J.T.PATEL
1
Types of OS (Cont…)
4. Personal computer operating systems
• The operating systems installed on our personal computer
and laptops are personal OS.
• Job of this OS is to provide good support to single user.
• This OS is widely used for word processing,
spreadsheet and internet access.
• Examples: Linux, Windows vista and Macintosh.
PROF J.T.PATEL
5 PROF J.T.PATEL
1
Types of OS
(Cont…)
5. Handhelds computer operating systems
• A handheld computer or PDA (Personal Digital Assistant) is
small computer that fit in a Pocket and perform small
number of functions such as electronic address book,
memo pad.
• The OS runs on these devices are handheld OS.
• These OS also provides ability to handle telephony, digital
photography and other functions.
• Examples: Symbian OS, Palm OS.
PROF J.T.PATEL
PROF J.T.PATEL
Types of OS (Cont…)
9. Smart card operating systems
• Smallest OS run on smart cards which are credit card sized
devices containing CPU chip.
• These OS are installed on electronic payments cards such
as debit card, credit card etc.
• They have limited processing power.
• Some smart cards are Java oriented. ROM on smart card
holds an interpreter for the JVM – small program.
PROF J.T.PATEL
PROF J.T.PATEL
Types of OS (Revision)
1. Mainframe operating systems
2. Server operating systems
3. Multiprocessor operating systems
4. Personal computer operating
systems
5. Handhelds computer operating
systems
6. Embedded operating systems
7. Sensor node operating systems
8. Real time operating systems
9. Smart card operating systems
PROF J.T.PATEL
62
6 PROF J.T.PATEL
1
Operating system
structures
1. Monolithic systems
2. Layered systems
3. Microkernel
4. Client-server model
5. Virtual machines
• VM/370
• Virtual machines
rediscovered
• The java virtual machine
6. Exokernels
PROF J.T.PATEL
PROF J.T.PATEL
Monolithic systems
The entire OS runs as a single program in kernel mode.
OS is written as a collection of procedures, linked together
into a single large executable binary program.
Each procedure has well defined interface in terms of
parameter and results, and each one is free to call any
other one.
A main program that invoke the Main
requested service procedure. Procedur
e
A set of service procedures that carry Service
out the system calls. Procedure
A set of utility procedures that s
Utility
help the service procedure. Procedur
e
PROF J.T.PATEL
PROF J.T.PATEL
Layered systems
In this system, the OS is organized as a hierarchy of layers.
The first system constructed in this way was THE system.
Grouping of Functions in a layer
The functions related to a category are grouped together and
made a layer of that category.
The top most layer provides the interface to applications of the
users.
PROF J.T.PATEL
The lowest layer interacts with the underlying hardware.
• Each layer can communicate with only layers immediately below or
above it.
• Moreover, a layer uses the services of the layer below it.
• Debugging is easy.
PROF J.T.PATEL
8 PROF J.T.PATEL
0
Modules
Many modern operating systems implement
loadable kernel modules
Uses object-oriented approach
Each core component is separate
Each talks to the others over known interfaces
Each is loadable as needed within the kernel
Overall, similar to layers but with more flexible
Linux, Solaris, etc
Solaris Modular Approach
Hybrid Systems
kernel environment
BSD
Mach
Application Framework
surface media
Dalvik
manager framework
virtual machine
webkit libc
Linux kernel
Multiprogramming v/s Multiprocessing v/s
Multitasking
Multiprocessi Multitaskin
ng g
Multiprogrammi
ng
PROF J.T.PATEL
885 PROF J.T.PATEL
1