Chapter-1 ITM
Chapter-1 ITM
Unit-1:
g Chapter
Systems:
Internals 1 Computer
and
Design System
Principles O
verview By William
Stallings
Operating System as a Resource Manager
Exploits
the hardware resources of one
or more processors ( primary memory,
secondary memory, I/O, File)
Providesa set of services to system
users which manages resources &
processes.
Manages secondary memory and I/O
devices.
Basic Elements of Hardware
• Hardware which are managed by OS.
I/O
Processor Modules
Main System
Memory Bus
Controls the Performs the
operation of data
the computer processing
functions
Referred to
as the
Central
Processing Unit
(CPU)
Functionality of Processor
• Processor Executes statements/ instructions
which are written within our program with the
help of Dispatcher (part of OS) .
08/23/2024 ITM_Sem-IV_2022 5
Main Memory(Primary memory)
Volatile/
after execution of
process, data will be deleted
from P.M.
Contentsof the memory is lost
when the computer is shut
down
Referred
to as real memory
or primary memory
I/O Modules
storage (e.g.
hard
Moves data drive)
between
the
computer communications
and equipment
external
environmen termina
ts such as: ls
Provides for communication
among processors, main
memory, and I/O modules
Establish communication, data
are tranferred through System
bus.
CPU Main Memory
0
System 1
PC MAR Bus 2
Instruction
Instruction
Instruction
IR MBR
I/O AR
Data
Execution
unit Data
I/O BR Data
Data
PC = Program counter
IR = Instruction register
Buffers
MAR = Memory address register
MBR = Memory buffer register
I/O AR = Input/output address register
I/O BR = Input/output buffer register
processor reads
(fetches) processor
instructions from executes each
memory instruction
Two steps
Fetch Stage Execute Stage
1 4
I/O
Command
Figure WRITE
5
1.5a 2
END
Flow of
Control
Withou
WRITE
t 3
Interrup WRITE
ts (a) No interrupts
User I/O
Program Program
1 4
I/O
Command
WRITE
2a
Figure Interrupt
1.5b
2b
Handler
WRITE 5
Short I/O 3a
END
Wait
3b
WRITE
1 4
I/O
Command
WRITE
Figure 2
1.5c Interrupt
Handler
5
Long I/O
WRITE
END
Wait 3
WRITE
i
Interrupt
occurs here i+1
Interrupts
Disabled
Check for
Fetch next Execute interrupt;
START instruction instruction initiate interrupt
Interrupts
handler
Enabled
HALT
1 1
4 4
I/O operation
I/O operation;
processor waits
2a concurrent with
processor executing
5 5
2b
2
4
I/O operation
4 3a concurrent with
processor executing
I/O operation;
processor waits 5
5 3b
1 1
4 4
5
2
4
4
3 I/O operation
concurrent with
I/O operation; processor executing;
processor waits then processor
waits
5
5
Device controller or
other system hardware
issues an interrupt
Save remainder of
process state
information
Processor finishes
execution of current
instruction
Process interrupt
Processor signals
acknowledgment
of interrupt
Restore process state
information
Processor pushes PSW
and PC onto control
stack
Restore old PSW
and PC
Processor loads new
PC value based on
interrupt
Stack Stack T
T N+1 Y+L+1
Program Program
Counter Counter
Y Start Y Start
Interrupt General Interrupt General
Service Registers Service Registers
Y+L Return Routine T Y+L Return Routine T–M
Stack Stack
Pointer Pointer
Processor Processor
T–M T
N User's N User's
N+1 N+1
Program Program
Main Main
Memory Memory
An interrupt occurs
while another Two approaches:
interrupt is being
processed
• e.g. receiving data • disable interrupts
from a while an interrupt
communications is being processed
line and printing • use a priority
results at the same scheme
time
Memory
• Without utilization of Primary memory, processor can not execute any
instruction with the help of OS.
Greater
Faster capacity
access = smaller cost
time Greater
per bit capacity =
=
greater slower
cost access
speed
per bit
Going down Inb
g-
Re rs
iste
e
the
Me oard ch
m Ca
or y in
Ma ory
em
M
hierarchy: Ou
tb
Sto oard gn OM
etic
Dis
k
r
age Ma D-R W
C -R
CD -RW
VD AM
D R
V D- y
D lu-Ra
decreasing cost
B
per bit
Of e
f- Tap
Sto line etic
r
age gn
Ma
increasing
capacity
increasing
access time Figure 1.14 The Memory Hierarchy
Secondary
Memor
y
Also referred to
as auxiliary
memory
• external
• nonvolatile
• used to store
program and data
files
Invisible to the OS
Interacts with other memory management
hardware
Processor must access memory at least once per
instruction cycle
Processor execution is limited by memory cycle
time
Exploit the principle of locality with a small, fast
memory
Block Transfer
Word Transfer
-1
Block Length
(K Words)
(a) Cache
Block M – 1
2n - 1
Word
Length
(b) Main memory
RA - read address
Receive address
RA from CPU
Load main
Deliver RA word
memory block
to CPU
into cache
slot
DONE
number
of block
cache size
levels
Main
categori
es are:
writ mappin
e g
polic functio
y n
replaceme
nt
algorith
m
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
Direct Memory Access
(DMA)
∗ Performed by a separate module on the
system bus or incorporated into an I/O module