Chapter-6 Memory Management
Chapter-6 Memory Management
Date
M e m o r y Management
x Baelg Hardware
Whenever a process is created it has to be
loaded on a physical rmemoryfor ils success-
Fu executionEveru process hao a separate
mempry epace on phusical _memoruThere
is need to_determine range ot. leqal
1 Oddress es that the prDces may access and
to ensure that process can accesS anly
these legal addresacss
he memory protechon is achieved by
uaing uo reqisters base register and limt.
1eqieter h e base eqister contains_
Smallest legal physical address (First leqal_
phusical address ) at phuoical menony dssiqne
tothat panticulor procesa.lhe limit reqister
specifies he Size dE fhe processi.e totalL
number ot physical addhésses assiqned to_
hat proce5
peratng-
Systern 1510
Process P
Last adeoS|
PLS Process Pa
232L
hysical MMemOry
PLSBase= 1SiD Camlin Page
No INO
Physical
mémoy
Address Bindioq
Bindina betuueen_instructions ot the
preces6 and phusical addresses On O
phusical mermory Can be_dane_at any
the folouinq time
Compile time
1t indicates that phusical addresoes
oamemoTy0Te determined at
Camlin Page
Date
Logi.cal Addreess
Anaddress qenerated bu o CPu.
scalled as loqical address
Physlcal Addre63
Physicd addresg ie an_addreoe on
a memory unit Cphysical memors
Camlin Page
Date
Relocation
Regieter
Phusicol
sPUogtcar 0ddTesS
AddresS 1100 Jsi0
410
MMU
Physical
mernDM-
Dunamic Relocanion_USinqnelocathon xeaisBey
RDynamic Loading
La this a routine dt a pazhicular progra
nDt loaded until it is called
The advantage c dyndmic loadinq is
that an unuscd roufine iis never loacded
*Swappiha
owappinqisa technique cttenpoTa-
nily moving apTOcess from-physical
memory Ao abackinq store (secondou~
storage ) and hen binq back into
main_memory- forconhinued execuhion.
-
Camlin Page
Date
Operoino-
System
1 Suap
Out Ronese
8uwoOp
Prores
P
uSer
spoce
a
backina store
uappina t u o pocesa5 disk as
backing Store
NOy mally a process ihat iD swagued
Out oil be suapped back into fhe same.
memoxy Bpaceit
itoccapied meviously. I
binding i9 done at compile OT Ioad time
fben he process (an not be easilumOYEd.
D O difterent lbcation But ifexecuion
indin9.
time addhess neis USed the pTOLCE
Can b e
SuappedintD 0 difterent mcm014
Space because fHe phuical addicsses-
ale Compufed duming execuion
timt
Memeit AHacatien
Memer
Camlin Page
|Date
limit relocanon
reister Tester
First- it allocation
This allocotion technique allocates irst.
Ovailable pantiion uubich s bi9 enougb
J
Bestfit allocatiaD_
Ihis Aechnique allocates snallest.
Duailablepootition to the precess
which is_biqenoLugh or the alldcation-
t h e 1ocess Ihis technique equ
25 iD ech entixe list o Otitions o-
the allocation.
3 Norat-it allocation
This sehnique allocates a panthtiO
Camlin Page
Date
gtihionA
pmhion B
pahhoh C
oD
paTitinn D
Physical memDIY
Eraqmentation
ContiouOuS memory allocaten has a
problem oi inteinal aamentahion
and exBernal iraqmentaion
Intemal fragmeptation
Cpavtiton)
The memary, allbcaled Ad the
pb.cess may be laTQer than the
oSi2 he proce65 The difEere.nce
behueen pantihion Size and pmocese
Szc iacalled as internal fraq
mentatho.o
Pror ess Po
Panhhon A
35o
busical Memsru
In INendiagigm, o.artinan A-
size 400 is albcated m the
prOces6 Pa uoith sizc z60 I n
this Cose 50 memoru |o.cahoD-
t h e phlusical_memors_can ptl-
Camlin|Pa
Date
be uilized Since they ae
intenal fo
pantition A
External fraqmentaBhion
External åraqmentation exist
when here s enough total space
tD saisfs_a equestai a
pYocess
but the avai able epaces Q1e nof
Contiauous IEstorage is roq
1amented intp_laxqe. numbex ot small
parhops external fraqmentaton Can
Pracess P
39
Panhtion B PIOCess P
- - 600
Honpmoblem
Orocf5 s_ n be epoct
n00-Coniquoug
Hesce pIDcess Can be olldcated o
physiml memo ohereser it 19
vailable
CamlinPage
Date
Paging
Poqing 1 O MemOnu nanaaement
echnlque that permits phusicol addres
SpaaGe O dp1bcess t be Don-conh-
quous
The basic me thod for implemen
ing paging- nvolves breaking phuscal
memory into Äxed sizc, blocks called
framesand bneakinq loqicaaddres
Space dt a pmocees ino blocks at the
Samesize Called_gs Pages
WheneNeT C pocess is D be
execut ed its pages are Daded into
1sQny avalable mem oTu rames on
aphusical
J memoTY
Everyoqical addnesa
generatecl intd cPU is divided inta
2 pants Page Numbt Cp)E
age_otfaet LdO
he poage number is 0sed
as on index into oqe table The
page table contain9 base addaess
C) e4 each page in physicalmemoiy
h i s base oddrcos,is com-
bined oifh page oftsct@to generoe
phusil aempty_add)ecs carespo Hd-
jna o loaical add1ess qeneroted by
eP
Camlin Poge
Date
toqicol
addvess|
P Pd
physica
oddses5
physico|
mem.oY U
Poge Toble
Paging horduoo1e
Tn poginq there isno probem of
exteyna froomentation since any ree
Frame can be allocated to a
that needs itbut there prOcess
poblem ot
is a
internal
in paging
fraqmentathon-
* Mapping of \ogical address intD corres1
ponding physical addTess
Considler a process dt size
1G by
ConsideTpage size is 4 bytes
physical
physical
memOTyis tE32 bytes
To executeTnot pTOcess OS haS
lDaded pag OOntd irarne B,
Pac 1 Onto frame 3, poge 2 -
Camlin Page
b
Page
2
Fboe
1
3 O
2
mPage 3
Paae 2
Table 13 rorne
A5
Process5 iome
20
22 5
20 2,
25
26
28
2 |tam
30
3
Phueical
memoT
Paging
*Paqinq hardusane uwith TLB.
TLB
Physico
odress
d
TLB mi6S
Pogt Physical
Table MemorKy
Poqina Harduwaxe uwithTLB
Camlin Page
Date
*aeameatation
Seqmentation_15 0 memoru_managc-
ment Scheme hat Suports iser view vie
s t memoru-
In seqm.entation, lcqical Oddiess
space et apOcess is divided intD 0o.
oseaments Each seqment f o pDCCS5
has a 6eament Aundber In seqmentanon,
oqical addre55 consists ottuo tupple
seament-number, sCqment -citset.-
Seaments oB a precess can be.
1code seqment
9 Data seqment
2 Stack seamem
4 Heap seament
5 )Standand librany ecamert
ezmen JTble
Piysica
address
d yes
No
Example o f Seqmentahon
Logical oddress C2,2 so
Camlin gzare
S2gment nate
o
5cgrmento|
Stack Code
limit base
SEqmEnto SComent 1 390D
4o6 Segmet 3
500
Stondae 4 G30d segment 2|
Dato heop 160
librory 400 4 30o| segmert 4|
Roment 2 Seqmert 3 egmem 6100
3 Oo 3200
4100 1o0 segment4
Loqical addicSs Spacee Seqment toble 6To0
of aplocesS Physical
TTemoT
Adantuq cs
Size cB the pTOcess cin be
than SIZe
laTqer
otthe
phusical mcmory
Since Lach pPIOCESS, ess phusica
memaT morepTOCesses Can uD
at the sametime whicb
at the
inreas
CPU utilization and thIouahput
3 Less 1/ois_ needed to ioad
oY wap pIOcess9es tota memory
Logica addrcss =Ç41 640
egmert nunmbeCamlinlPage
smen
FSSEt
Date
Demand Paging
Demand Paqinq i commonly
uSed in_Vixtual-nemen eystem
lh demand pounq intially ooly
eu
teu pages aprocess dre loaded intu
phusical memb14 whicb CTebeeded
l i t h demand paqngpaests p.acrs
ae only loaded ushen fhey a
demanded duninq execution e mocess
A handüiane Suppomt is
needed a ndicote hat uhickh paaes
pmoceS6 Oe on phusical memorq
Lohich paqes ofprocess ane not
On physical membry Fox this,-
PagetableContain additional ield
called as valid -invalid bit field
20 paqe s on_ phusical memon
then paae 4able ent m hat poqe
ls moked a s valid ( ) . 1E paqe is
paqeis
not on phusicol_memory, paqe table
entry
enttu Oí hat p.age is maked as
invaiid Ci uohich is shouan 0 given
|Logica addressS =4, 670 Smert
Segmet nubeCumin Page
Date
Demand Paging
Demand Paqinq i s commonly
Used n virtual-memaiu 8ystem
lh_demand pagunq iniially ooly
teu pages d_a process are loaded int
physical mem.o1y which CATe eeded_
l a i t h demand pagingphastspaqrs
a e only loaded_when hey Are
demanded duinq executiop spOCess
A hadanane suppomt is
needed nindicate hat ushich paqes
15 paoces601eon phusical memary4
Lobich paqesof process ane not
phuysical membry Fox this,
pagc table_contain addittonalield
called as valid -invalid bit field.
paae is onn phusical memo
then paae 4able _entiu fnn that paqc
s Maked as valid (v)ifpaqe is
not on physical memoy poqe ta ble
entry hí Ahat pcqe is mamked as
invalid C uohich is shoun a qiven
Camlin Page
1 Torne
number
ddress
Frame No olid Inulid
brt
2 v A
3 D DE
3
E 4 L
opoce D
PTOCess
Phusical
memorY
Date
storogee
25
Camlin Page
20
2)
Tap
(1eence
load
Restant
instiuchon
Paqe bocking
stnìe
Tabte
Bving
misang9
Free framnek aqe
Reset Paqe-
table