1. What is Operating System?
• Operating system is a program that controls the
execution of application programs.
•It is an interface between applications and
hardware
2. SYSTEM PROGRAMS
Support the operation of a computer
system and help the programmer to
simplify programming process and
create an environment to run
application software efficiently.
3. Software types :
- Application s/w
- System s/w
System s/w types:
- To create program development
environment ( TE,Compiler,
Assembler, Debugger)
- To create run time environment
(Loader, Libraries, OS)
6. Basic Elements
Processor - Controls the operation of the
computer and performs its data processing
functions.
Main memory - Stores data and programs.
I/O Module - Move data between the computer
and its external environment.
System bus - Provides for communication
among processors, main memory and I/O modules.
7.
8. H/W and S/W
Bus – To communicate between
devices
Booting (init)
Interrupt – To send signal to CPU
(s/w interrupt – system call)
10. Instruction Execution
A program consists of a set of
instructions stored in memory .
Instruction execution takes place in CPU
registers
• processor reads (fetches)
instructions from memory
• processor executes each
instruction
Two steps:
12. The processor fetches the instruction
from memory
Program counter (PC) holds address of
the instruction to be fetched next
PC is incremented after each fetch
13. Instruction Register (IR)
Fetched instruction is
loaded into Instruction
Register (IR)
Processor interprets
the instruction and
performs required
action:
Processor-memory
Processor-I/O
Data processing
Control
16. Interrupts
• It is an event external to the currently executing
process that cause a change in the normal flow of
instruction execution.
• They tell the CPU to stop its current activities and
execute the appropriate part of the OS
Interrupt the normal sequencing of the processor
Provided to improve processor utilization
most I/O devices are slower than the processor
processor must pause to wait for device
wasteful use of the processor
17. • 3 Types
1.Hardware- generated by h/w
2.Software- generated by
Programs
3.Trap- generated by CPU
22. Multiple Interrupts
An interrupt occurs
while another interrupt
is being processed
• e.g. receiving data
from a
communications line
and printing results at
the same time
Two approaches:
• disable interrupts
while an interrupt is
being processed
• use a priority scheme
23.
24.
25. Cache memory is smaller, faster memory
and it contains a portion of main memory.
When processor attempts to determine if
the byte or word is in the cache.
If so, the byte or word is delivered to the
processor.
If not, a block of main memory, contains
data, is read into the cache and then the
byte or word is read into the cache and then
the byte is delivered to the processor.
28. CACHE DESIGN
KEY ELEMENTS:
1. Cache size
2. Block size
3. Mapping function
4. Replacement algorithm
5. Write policy
6. Number of cache levels
29. DIRECT MEMORY ACCESS
Three techniques are possible for I/O
operations:
Programme
d I/O
Interrupt-
Driven I/O
Direct Memory
Access (DMA)
∗ I/O TECHNIQUES
30. Programmed I/O
The I/O module performs the requested
action then sets the appropriate bits in the
I/O status register
The processor periodically checks the
status of the I/O module until it determines
the instruction is complete
With programmed I/O the performance level
of the entire system is severely degraded
31. Interrupt-Driven I/O
External asynchronous input is used
to tell the processor that I/O device
needs its service and hence
processor does not have to check
whether I/O device needs its service
or not
32. Direct Memory Access
(DMA)
When the processor wishes to read or
write data it issues a command to the
DMA module containing:
• whether a read or write is requested
• the address of the I/O device involved
• the starting location in memory to
read/write
• the number of words to be read/written
33. Transfers the entire block of data
directly to and from memory without
going through the processor
processor is involved only at the beginning
and end of the transfer
processor executes more slowly during a
transfer when processor access to the bus is
required
More efficient than interrupt-driven or
programmed I/O
35. Symmetric Multiprocessors
(SMP)
A stand-alone computer system
with the following characteristics:
◦ two or more similar processors of comparable
capability
◦ processors share the same main memory and are
interconnected by a bus or other internal connection
scheme
◦ processors share access to I/O devices
◦ all processors can perform the same functions
◦ the system is controlled by an integrated operating
system that provides interaction between
processors and their programs at the job, task, file,
36. Performance
• a system with multiple
processors will yield
greater performance if work
can be done in parallel
Availability
• the failure of a single
processor does not halt the
machine
Incremental Growth
• an additional processor can
be added to enhance
performance
Scaling
• vendors can offer a range
of products with different
price and performance
characteristics
38. Multicore Computer
Also known as a chip multiprocessor
Combines two or more processors
(cores) on a single piece of silicon (die)
each core consists of all of the
components of an independent processor
In addition, multicore chips also include
L2 cache and in some cases L3 cache
39. Intel Core i7
Supports two forms of external communications to other
chips:
DDR3 Memory Controller
• brings the memory controller for the DDR (double data rate)
main memory onto the chip
• with the memory controller on the chip the Front Side Bus is
eliminated
QuickPath Interconnect (QPI)
• enables high-speed communications among
connected processor chips
41. OPERATING SYSTEM
OBJECTIVES AND FUNCTONS
•Operating system is a program that
controls the execution of application
programs.
•It is an interface between
applications and hardware
42. OPERATING SYSTEM
OBJECTIVES AND FUNCTONS
•Convenience – To users
•Efficiency – Resources usage
•Ability to evolve – permit effective
development, testing
44. End user’s view – Applications through
application programs
Libraries – Assist in program creation,
management of files, control of I/O devices.
OS – Masks the details of hardware from
programmer
45. OS as Resource manager
• A computer is a set of resources for the
movement, storage, and processing of
data and for the control of these functions
• The OS functions in the same way as
ordinary computer software; that is, it is a
program or suite of programs executed by
the processor.
• The OS frequently relinquishes control
and must depend on the processor to
allow it to regain control.
46.
47. OS services
1.Program development – provides facilities
such as editors in creating programs
2.Program execution – loading program into
memory, I/O devices and files initialization
3. Access to I/O devices – using reads and
writes
4.Controlled access to files – protection
mechanisms in accessing in multiuser
system
48. OS services
6.Error detection and response – Hardware
errors - such as a memory error, or a device
failure or malfunction;
Software errors - division by zero, attempt to
access forbidden memory location.
OS provides a response that clears the error
condition
7.Accounting:
A good OS will collect usage statistics for
various resources and monitor performance
parameters such as response time.
-> To improve performance in future
-> Billing in multiuser system
50. OS services
8.Instruction set architecture
This interface is the boundary between
hardware and software. Both
application programs and utilities may
access the ISA directly.
51. OS services
9.Application Binary interface
The ABI defines the system call interface to the
operating system and the hardware resources
and services available in a system through the
user ISA.
10.Application programming interface
The API gives a program access to the
hardware resources and services available in a
52. Ease of Evolution of Operating
Systems
Hardware upgrades plus new types of
hardware – paging hardware
New services – For user demands
Fixes
53. Evolution of Operating
Systems
1.Serial processing(1940 – 1950)
◦ No operating system
◦ Machines run from a console with display
lights, toggle switches, input device, and
printer
Programs in machine code were loaded
via the input device (e.g., a card reader).
If an error halted the program, the error
condition was indicated by the lights.
If the program proceeded to a normal
completion, the output appeared on the
printer.
54. Problems:
1.scheduling:
If the user not finish in the allotted time, and be
forced to stop before resolving the problem.
2. Set up time:
A single program, called a job could involve
loading the compiler plus the high-level
language program (source program) into
memory,
saving the compiled program (object program)
and then
loading and linking together the object program
and common functions.
If an error occurred, the user typically had to go
back to the beginning of the setup sequence.
55. 2.Simple batch system
◦ Monitor -Software that controls the sequence of
events
the user no longer has direct access to the
processor.
the user submits the job on cards or tape
to a
computer operator.
He batches the jobs together sequentially
and places the entire batch on an input
device, for use by the monitor.
Each program is constructed to branch
back to the monitor when it completes
processing, at which point the monitor
automatically begins loading the next
program.
56. Job Control Language
Special type of programming language
Provides instruction to the monitor
◦ What compiler to use
◦ What data to use
57. Requirements:
1.Memory protection:
While the user program is executing, it
must not alter the memory area
containing the monitor.
If such an attempt is made, the
processor
hardware should detect an error and
transfer control to the monitor.
monitor would then abort the job, print
out an error message, and load in the
next job.
58. 2.Timer:
A timer is used to prevent a single job
from monopolizing the system.
The timer is set at the beginning of
each job.
If the timer expires, the user program
is stopped, and control returns to the
monitor.
59. 3. Privileged instructions
Certain machine level instructions are
designated privileged and can be
executed only by the monitor.
If the processor encounters such an
instruction while executing a user
program, an error occurs causing control
to be transferred to the monitor.
4. Interrupts:
Early computer models did not have this
capability. This feature gives the OS
more flexibility in relinquishing control to
and regaining control from user
programs.
60. MULTIPROGRAMMING
Two or more programs in the memory
at the same time and sharing
processor
OS keeps number of programs in
memory.
It selects and executes one program.
All other programs are in job pool
which is in disk.
61. Memory management is required to
manage the memory for processes.
CPU scheduling is applied for
selecting process from memory.
Function of MP is combination of I/O
Management, CPU scheduling and
memory management.
65. Time Sharing Systems
Time sharing-Multi Tasking
Logical extension of multiprogramming
User interaction is possible
Multi users share computer system
simultaneously.
Concept of virtual machine used
66. First time-sharing operating systems -
Compatible Time-Sharing System
(CTSS) , developed at MIT by a group
known as Project MAC (Machine-
Aided Cognition, or Multiple-Access
Computers).
69. Computer System Organization
Computer-system operation
◦ One or more CPUs, device controllers connect through
common bus providing access to shared memory
◦ Concurrent execution of CPUs and devices competing for
memory cycles
70. Computer-System Operation
Booting :
1. Bootstrap program is stored in ROM or EEPROM.
2. It initializes all the system components, from CPU
registers to device controllers.
3. The bootstrap program knows how to load operating
system and how to start executing that system.
4. To accomplish this goal, the bootstrap program must
locate the operating-system kernel and load it into
memory.
5. Once the kernel is loaded and executing, it can start
71. Computer-System Operation
On UNIX, the first system process is “init,” and it
starts many other daemons.
Once this phase is complete, the system is fully
booted, and the system waits for some event to
occur.
The occurrence of an event is usually signalled by
an interrupt from either the hardware or the
software.
Hardware may trigger an interrupt at any time
by sending a signal to the CPU, usually by way of
the system bus.
Software may trigger an interrupt by executing a
special operation called a system call (also called
a monitor call).
72. A table of pointers to interrupt routines can be used
instead to provide the necessary speed.
The interrupt routine is called indirectly through the
table
The table of pointers is stored in low memory (the first
hundred or so locations).
These locations hold the addresses of the interrupt
service routines for the various devices.
This array, or interrupt vector, of addresses is then
indexed by a unique device number, given with
the interrupt request, to provide the address of the
interrupt service routine for the interrupting device.
EX: Windows and UNIX dispatch interrupts in this
manner.
73. Storage Definitions and Notation Review
Computer storage, along with most computer
throughput, is generally measured and manipulated
in bytes and collections of bytes.
A kilobyte, or KB, is 1,024 bytes
a megabyte, or MB, is 1,0242 bytes
a gigabyte, or GB, is 1,0243 bytes
a terabyte, or TB, is 1,0244 bytes
a petabyte, or PB, is 1,0245 bytes
74. Storage Structure
Main memory – only large storage media that the CPU
can access directly
◦ Random access
◦ Typically volatile
Secondary storage – extension of main memory that
provides large nonvolatile storage capacity
Hard disks – rigid metal or glass platters covered with
magnetic recording material
◦ Disk surface is logically divided into tracks, which are
subdivided into sectors
◦ The disk controller determines the logical interaction
between the device and the computer
Solid-state disks – faster than hard disks, nonvolatile
◦ Becoming more popular
75. Storage Hierarchy
Storage systems organized in hierarchy
◦ Speed
◦ Cost
◦ Volatility
Caching – copying information into faster
storage system; main memory can be viewed as
a cache for secondary storage
Device Driver for each device controller to
manage I/O
◦ Provides uniform interface between controller
and kernel
77. Caching
Information in use copied from slower to
faster storage temporarily
Faster storage (cache) checked first to
determine if information is there
◦ If it is, information used directly from the
cache (fast)
◦ If not, data copied to cache and used
there
Cache smaller than storage being cached
◦ Cache management important design
problem
◦ Cache size and replacement policy
78. I/O Structure
I/O devices and the CPU can execute
concurrently
Each device controller is in charge of a
particular device type
Each device controller has a local buffer
I/O is from the device to local buffer of
controller
Device controller informs CPU that it has
finished its operation by causing an interrupt
79. After I/O starts, control returns to user program only
upon I/O completion
◦ Wait instruction idles the CPU until the next interrupt
◦ Wait loop (contention for memory access)
◦ At most one I/O request is outstanding at a time, no
simultaneous I/O processing
After I/O starts, control returns to user program without
waiting for I/O completion
◦ System call – request to the OS to allow user to
wait for I/O completion
◦ Device-status table contains entry for each I/O
device indicating its type, address, and state
◦ OS indexes into I/O device table to determine
device status and to modify table entry to include
interrupt
80. Direct Memory Access Structure
Used for high-speed I/O devices able to
transmit information at close to memory
speeds
Device controller transfers blocks of data
from buffer storage directly to main memory
without CPU intervention
Only one interrupt is generated per block,
rather than the one interrupt per byte
81. Operating System Structure
General-purpose OS is very large
program
Various structure
◦ Simple structure – MS-DOS
◦ More complex -- UNIX
◦ Layered – an abstraction
◦ Microkernel -Mach
82. Simple Structure -- MS-DOS
Small and simple
in size
In new versions –
size increased
Application
programs directly
interact with BIOS
driver(DA)
83. Non Simple Structure --
UNIX
UNIX – limited by hardware functionality,
The UNIX OS consists of two parts
◦ Systems programs
◦ The kernel
- Provides system calls for the file
system, CPU scheduling, memory
management
85. Layered Approach
The operating system is
divided into a number of
layers (levels),
The bottom layer (layer 0), is
the hardware;
the highest (layer N) is the
user interface.
Functionality of each layer is
fixed.
Each layer consist of data
structure and set of routines
With modularity, layers are
selected such that each
uses functions (operations)
and services of only lower-
level layers
Each layer is using system
calls for performing their
86. Kernel
Kernel is a sw code that resides in the central
core of a operating system.
Shell is outer part of OS and it interacts with user
commands.
Kernel does not directly interact with user. It
interacts with shell.
Kernel is the first part of OS loaded into memory
and remains entire computer session.
Kernel code is in protected area in memory.
Kernel works in kernel space.
User performs in user space.
Memory – two areas
1. System area 2. User area
87. Kernel content includes
- Scheduler(Alloc time to proc)
- Supervisor (Grants permission to
process to use resources)
- Interrupt handler (Handles all
requests from devices for service)
- Memory manager(Alloc mem
space)
89. Monolithic kernel
Traditional UNIX uses
OS runs as a single program in kernel
mode
Operations done via system call
LINUX and Free BSD uses modern
ML
90. Micro kernel
Provides minimal services such as
defining memory address space, IPC
and process management.
Provides communication facility
between client programs
Communication takes place using
message passing
Microkernel runs in kernel mode and
rest run in user mode
93. Modules
Many modern operating systems implement
loadable kernel modules
the kernel has a set of core components and
links in additional services via modules
This type of design is common in modern
implementations of UNIX, such as Solaris,
Linux, and Mac OS X, as well as Windows
94. The Solaris operating system structure,
is organized around a core kernel with
seven types of loadable kernel modules:
1. Scheduling classes
2. File systems
3. Loadable system calls
4. Executable formats
5. STREAMS modules
6. Miscellaneous
7. Device and bus drivers
96. Hybrid Systems
Most modern operating systems are actually
not one pure model
◦ Hybrid combines multiple approaches to
address performance, security, usability
needs
◦ Linux and Solaris kernels in kernel address
space, so monolithic, plus modular for
dynamic loading of functionality
◦ Windows mostly monolithic, plus microkernel
for different subsystem personalities
Apple Mac OS X hybrid, layered, Aqua UI plus
Cocoa programming environment
97. System Calls
System calls provide an interface between
running program and an operating system.
OS provides services and system call provides
interface to these services
Typically written in a high-level language (C or
C++)
A system call is an explicit request to kernel
mode via software interrupt.
It is like procedure call but system call enters
kernel.
All system call return an integer value.
In the kernel positive or 0 denote successful
termination and negative value denotes error
98. Mostly accessed by programs via a high-
level Application Programming Interface
(API) rather than direct system call use
Application developers design programs
according to an application programming
interface (API).
Three most common APIs are
- Win32 API for Windows,
- POSIX API for POSIX-based systems and
- Java API for the Java virtual machine
(JVM)
99. Three general methods are used to pass
parameters to the operating system.
1. The simplest approach is to pass the
parameters in registers. This is the
approach taken by Linux and Solaris.
2. Parameters also can be placed, or
pushed, onto the stack by the program
and popped off the stack by the
operating system.
3. The parameters are generally stored in a
block, or table in memory, and the
address of the block is passed as a
parameter in a register
102. Types of System Calls
System calls can be grouped roughly
into six major categories:
file management,
process management,
I/O device management,
information processing and
maintenance,
Inter process communications
protection
103. File management
◦ create file, delete file
◦ open, close file
◦ read, write, reposition
◦ get and set file attributes
104. Process management
◦ create process, terminate process
◦ end, abort
◦ load, execute
◦ get process attributes, set process attributes
◦ wait for time
◦ wait event, signal event
◦ allocate and free memory
◦ Dump memory if error
◦ Debugger for determining bugs, single step
execution
◦ Locks for managing access to shared data between
processes
105. Inter process communications
Pipe, socket, message passing and shared
memory are used foe IPC.
System calls:
◦ Send message, receive messages
◦ create, delete connection
◦ attach and detach remote devices
106. I/O Device management
◦ request device, release device
◦ read, write, reposition
◦ get device attributes, set device attributes
◦ logically attach or detach devices
107. Information processing and
maintenance
◦ get time or date, set time or
date
◦ get system data, set system
data
◦ get and set process, file, or
device attributes
108. Protection
Protection provides a mechanism for
controlling access to the resources
provided by a computer system.
Historically, protection was a concern
only on multi programmed computer
systems with several users.
◦ Control access to resources
◦ Get and set permissions
◦ Allow and deny user access
110. System Programs
Modern OS is a collection of system
programs.
Provide application programming environment
on hardware for program development and
execution
◦ Some of them are simply user interfaces to
system calls; others are considerably more
complex
Categories of system calls:
File management - Create, delete, copy,
rename, print, dump, list, and generally
111. 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
112. 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
113. 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
114. 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,
115. Operating System Generation
n Operating systems are designed to run on any of a
class of machines;
The system must then be configured or generated for
each specific computer site, a process sometimes
known as system generation SYSGEN.
The operating system is normally distributed on disk,
on CD-ROM or
DVD-ROM.
To generate a system, we use a special program.
This SYSGEN program reads from a given file, or
asks the operator of the system for information
concerning the specific configuration of the hardware
system, or probes the hardware directly to determine
what components are there
116. System Boot
Boot strap program is stored in ROM
Boot strap program loads and
executes boot program
Boot program is stored in disk in
predetermined address called boot
sector
Boot program loads OS into
memory(Boot strapping)
117. Operating-System Operations
Interrupt driven (hardware and software)
◦ Hardware interrupt by one of the devices
◦ Software interrupt (exception or trap):
Software error (e.g., division by zero)
Request for operating system service
Other process problems include infinite
loop, processes modifying each other or
the operating system
118. Operating-System Operations
Dual-mode operation allows OS to protect
itself and other system components
◦ User mode and kernel mode(Monitor
mode)
◦ Mode bit provided by hardware
◦ Mode bit – 0 for monitor mode and 1- user
mode
Provides ability to distinguish when system
is running user code or kernel code
Booting – monitor mode
Some instructions designated as
privileged, only executable in kernel
mode
When interrupt occurs mode changes from
119. Clustered system
Group of computer system connected
with high speed communication link
Each computer has own memory
Integrated with H/W Cluster and S/W
cluster
H/W cluster - sharing disks, S/W –
control
Two types:
1.Symmetric
2.Asymmetric
120. Asymmetric:
- One machine is in standby mode
and monitors server while others run
applications. If server fails this
machine acts as server.
Symmetric:
Each host monitors other host
121. Distributed system
Computers connected via N/W
Distributed OS needed.
Resource sharing across computers and
users feel like using single machine
Adv:
1.Resource sharing
2.High reliability
3.Better price performance ratio
4.Response time and throughput
5.Incremental growth
Ex: Amoeba, chrous, mach and v-system
122. Network Operating system
User can login to remote resources
and access
Machines connected via
communication link
File transfer possible
Supports multiple user accounts
Ex: Telnet
123. Real time OS
Time constraints is the key parameter
Used in robotics, satellites
Types:
1.Hard real time system – Highly
restricted
2.Soft real time system – Relaxed time
bound
124. Handheld systems
Physical size is handheld
Ex: Mobile phone
Slow processor, small display, less
memory
OS Ex: Blackberry, Android, Windows
Uses wireless technology(BT, Wi-Fi)