0% found this document useful (0 votes)
41 views24 pages

Memory Management Part-1st

Memory management is the process of handling and managing primary memory and movement of processes between main memory and secondary storage. It keeps track of each process's location, allocates and manages memory, and decides which process will get memory and when. Static and dynamic loading refer to how programs are loaded into memory, either at a fixed address during compilation or loaded at runtime as needed. Swapping is the mechanism where processes can be temporarily moved out of main memory to secondary storage to make memory available for other running processes. The bare machine and resident monitor are low-level components that directly control instruction execution without using an operating system. The resident monitor manages job sequences, loads programs and controls basic computer operations.

Uploaded by

Happy shukla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views24 pages

Memory Management Part-1st

Memory management is the process of handling and managing primary memory and movement of processes between main memory and secondary storage. It keeps track of each process's location, allocates and manages memory, and decides which process will get memory and when. Static and dynamic loading refer to how programs are loaded into memory, either at a fixed address during compilation or loaded at runtime as needed. Swapping is the mechanism where processes can be temporarily moved out of main memory to secondary storage to make memory available for other running processes. The bare machine and resident monitor are low-level components that directly control instruction execution without using an operating system. The resident monitor manages job sequences, loads programs and controls basic computer operations.

Uploaded by

Happy shukla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

lemcr lanage ment

Xleme Mangement the unctionali of an


os
Lhich handles o manage
prima meme
and moue 8
ro ceSSeS back qnd cavh be hoccn
man mem
diak Jur ecu HOn.
Memy Planagement
euc
Keps track of Cqch qnd
memo
location, Tgardless ocither '
allocated + Sme
checks how rocess o it s Arce.
much
qllocated memo
mcmo A Ao be
ceSS 6S.
decides hich oces s Loill ac+ memo
at Lnat Hme

Uso rograms
Uge Inteace
Syatm Calles

File Mem Poce


Management mana aemenH |manaument|

Harclae
h g emor lanaaemem cqred-
o c ae and dc qllcaBe
memo and
aftcr Oces execution.
*To
To Ke
Kecp rach o d memoA Apate
ocos.
*To ini mige men dalion issues.
To
Pog udili3ation of min memor
To manadin date àndgri ile
o exeeup
hocess

*Logical Adde ss Spacoe


An q ddatss gen d by +he CPU i knuon
as Addrcss
glcal 14 J ao
Knoon as Nual qddresS.
*Losical AddvtsS 3pace can b ddincd
he 3e o he Pro ces.
A Logical cddrcs Can be
chanaea.
hahcal Address Space
A phyical Addes i aljo Knovon o
Rcal addres S
An addrese en memo
nemo ur
3.3 Com moni nosn a ahical Aa"
A Pyhcal Address
computed bMny.
SAatic and Dyngmic Loading
olaacd a pxocess he minmemor
one loader Thusc
o loadi
Satie oading
Loadia he ntive Pogram in-Ho a fncd

address requre S mrtmemo Apace.


Dynamicoadin
A dhe ogam o oaded in 4h

main Memo execuHon Somtimes


Complce oaam aded in to he memo,
bAomc Hmes a drain fart ouine
othe proaam JA loaded jnto the mam-

meme onl Lshen iA ealle he


o m , th machanAm Ja called
nemic
Loading onhanccthe
cermance
tatieand Dynamie tinking
To pexovm a linking a inker JA Ace.
A linkor
thet Aake one
mort obcc
Siles genevahd
Compilcv and Combincs
Jhem ino
inge cAccytable
She Linkin
T n S4atie Liakia ,the linkes Combincs all
Ce sS
ne a poaam modules n o
Sirg excuhble proaam.So he is
yntime
dependeng
Some opcvating Stäkm APpor only tahe
inKin
Dunamic Linkia
*Thbare Concep dgnamie linking JA
Similar o dy namic loading
x Aso , at Hmes onc am dependon
on ome othes oaam
n >uch a Casc therr ham ading
qI1 the dependent oram , cpu ink
Jhe dependent prOamng jo h Ma
eecyi P m ohen iH stquncd

Suapp3
Swappi Js a machani Jm in shith

Process Can be Sua prd dempoavily out


oo min mum cond
Om make Hat
8trgeColiak)
other auailable 4 memo
PceisecS A Aome t r
the Aam tim ,
Soa bacK he voes
Secondo oesrom Avom
Sb main memo
Main memo
Seeondoy Plmy

occss (2
roces s P3
30e fov o Laut
s
f-ocesef4|
ocess P Sapout

Suoa in ocets 3 Procossn


PL come bqck ftur Tlo

ProceSS-13- Sop out

Sapin ce-P1

q Madhine Qnd Resident Moniter

Th Bave Machine qnd'RcSdent Monitoy


not
d'ectl elated o
em but shile
Muely about
Meanaqement Mmo

mpoant Componont call


Oare Plachine

This he Simdes ey m o memo


Manaament
Bant machimc J losica horar Oich i
UmdA c c u t
Ahe YO m jn Ah
eceSSoY Lot vout usina Ahe
opa h A n.

Cxecuthon of gn
ntcAon À done
divecl on
rd Lourt Oithout ng
qn intefevins
ard Laae
machine Qcceptin9 the
instuchen in
machinc languag, dåe
ho pcrSon Ono n Aufticient Knesleds
about Compter lcld a able
Com puter. Ope

Residen Moniter -

The RcSiden Moni4er


cadc
On bare MachincS
Ahat
*4alao LOer an
operatim acm 4s
Comro th
inRtucthon& and
ne c e j a er Aorm
*
unctiomA al
a1
aMo
Oesk ihe ob cuen
SuenCeY
ceY becaua
aAScqucnces
eSS
he ob and
ond nds nds Ahem
ohe
o he
AAc Schedallimg the Job
ob Residont monitos lodua
onc by one i n 4o
man
ccevdina 4o her Asquence
hunOhtn he P m xccuion Occu cd thcrt

he Pom exocuhon and


he o cesSing is8oing o bb aS Her.
+ dásided into 4 Pavts as-

Contro} onauaac ntes pa-tter


oader
>Deuice Dviuer
>Jnttrrup rocess'img

Intumup
Psocosgin
Deyice
Diue
Resident Job
Monit
Sequencin3
Contro
language
inttpdt
oun da
oam
Con+iguous Memor Alocaion',-

Condiauous Memo qlloration ohich is q mem


ManageMent technigue, ohencu er theve JA a.
by he
rocess or he
Memovy hen a
Aingle Section o hc
Contiguous mcmo locKs
hat
process accrdin to JH requirmen.
qchicucd divding the memo
n4o the
ed-Si3c4 partiion
Contiguous Msme

Management Techniquot

Fxc-ge fartiaon Varri able -Sige


Seheme far tithen
Scheme

Fixce- Sige artition Scheme -


This tehnique s also Kmouon as
Slae
Pas4itioning ov fFixec Pars4idioni nq
The arnr 4ition ma cs may not be Ahe
he
Same Size.
The Size of cach Parsi4on J iaed a
ndicattd the name o he
Aechnique
qnd Can not be chanaed
Each Partition may Contain acl
Gxactl onc Oroce s S.

ogram gam- 6
PrgmS exit holc
o g a m 4- Pram 4
Progam 3 hole
eait
Pram -2 Pgm 2

Pram exit holc


P am o
ram o

oS

AdvatageS'.
Simple qnd iS ea to mplement
+A4Ppr multiproaramm a multi ple
Pcesses Can b tred insidehe mgm
memo
*
lanagcment JA
cas
Casyung his Schcmc
Variable Sige Par 4ition Seheme

4 s alco knocon qs Pasiti Oning

nAhis asti 4io ring,,Schemc allocation i don


donc

dumemicolly
The Si2e o Dar h4ion is not Jeclarcd inita'y
OheneuCY an oceSS G iNcS Psri+1on
S i S3
3 Cqua! oHhe Sigc of the
CYattd
Cattd
andhun allocatcd +0he psocess.
procesS

Size ot pariion Size of Psoce ss

OS

ProceSS
oceSs Pas ition
3m6
focc 3 2
ocesSP2 Pasti 4ion 2
SmB
Poccrs-P3
PoLcSS 3 MB fartition 3

Adwandag,
No ndeanal
ragmnq lion
Deqvec o multipogvomming i
mamic
to Limidalion on Si2e
Pro ccss
ngmic memoA Alocation. ttchniquet

-Cinsti4
fi4bes fiQmd onSt it anc
most Comman &ae ics d+o Adet re
hole rom h tt o quaila be

Fixsti+'-Tn, he Sivst i4, the i r


quailable rce hole ulCils thccquirement
he proce SS
allocateda.
* Scax ching Can &sr eithtY
athe innms
o4tSct o

E
20KB
OCe SS A

SK8

4o K8 Hole 40 -2S IS KB

6oK Le ouCS Sgace

Next 4 - ame
i
Aaveh a aM allocaion hole
BeS414 . Allocationihe Smalles holc 4hqt
SS bis cnough

SkO
occSS o kB

Hole 19 K0 o: 9
Ke ITA
4o KB
SokB

1 2 kB
orSit Aleation the lgesa holc.

rcc SS o KB
Hole So-lo 4ok8

raeice pro blem s Bascd on


memory loca ieon

oblem
Ciiuen memo asti tions
o ook6, 4oo Ke
GooKB,Soo ke ,3oc kG qnd So KB3
Thes
arrtHtions nccd o b
allacatee Ao our
Pces3 ofSi2e 3s
4
k6 ,210 KG KB
ane 431 K n hat od6.
BcA it& oYifit akoihm.usima fi fi+
SoluHon'.
The main memo no been dividtd antoiied
Po ionS as

Sook8
3oc ke
AsokB 60oKG
9ook

i c n poces sS Gt

ce SS P 21o k

oceSs f3 4c8 K8

ocess P4431 Ke

Allocakion Sing Fst fi+ Algothm'


t-3.

4ooKB ookO SooK6 3ook


Stp-2

P2
00KB3 4ook Sooke 2Soke
Stp-3.
2 P3

Qoo Kg 4ooke

Shp- 4, -
oce SS P Can hot be allocqd
he mum e ca no
pasition e
Sae ga than
Cualo h
Sig PocesSS
p4 aalale

To Pcme ariHon Available",-2gSokB


ToHal ud Ptfz+P3= 3sa210+ f68
l35 kB

Alloca ion SinaBestFt Alserithm. .


Sdep-

sooK8 SooK8 3ooKB 9SoK


ookg 4ooKG

Sp-2

P2

20KB 6cok SooKs


Sp-8
3 P2

20oKG 4ooK 6ookB Sook 2 SoKG


3ook
Sp-4-

P4 P3

6ooKB TookB 3 oke

Tota Auailale
Memar fatiHon 2QSo KB
Total d P
+2 +3t fq
3S+210+ 468+ 4 81

AllocatBon using LOrS Fi+ Algprithm-


Stp-

ooKB 4.ooKB ook SokG 2k6


Sh.2

ookg 6ookg SooKO 2 So k

Step3.-
oceSS f and P4 Can ho be
qllocqhee -he
memo
This becau
r +han
poraitio9 o Si3c
squaSqua o he
Paroce SS Sige o
P qnd
pocess p4 iu Quaila ble

Totl Auailable Memo


ariHon - 22So KO
Totaluud, - P+P 3S+ 21o
SLT KB

KemarA Bs algevhm mos


cieicent U o
mmor be cau imthic
afth ceSfes c
allocacel m
ilion LoiAh minimum
amndghon,
nttn
àattrna
Non- Contiguous Memo Ailocation
- 4 `S a
memoy 1 allocalion cchniguc.
alloos - o SAo a s o a Sing
in non-
Contiguou ashi on.
sing PoceSS

Thus, dfeyn} as
o hAame ore6 Can
an be
be
Stend at dif {oent
Placcs àn e main
memy
Non- Contauous -Memery Aloca1on
Technigues

Sgmentahon
*
Ohat is
aging
aginsa is a
fixed Si2earti on Scheme.
*In
8in Sccondary qnd man
memo e
diuidcd na o
equal fixed S2e avtilions
The
astitionS ofSeconden Memo
Called a g s.
The astitlomç o
smeme
Callcd o ams.
*Eaeh poocess uided anto
pasts h nescSize
Size
O Cach part J Same a Paae Size
yameS

Main mcmoy

Scconda ems
The Pages o process c SAort in ihe
ams ot main memoY
dependins upon
her
auaila bili

TanslaAng Logical AddstsS ito phytical


phtical
Asldnresa

CPCPU
aloays ncaad a
logical addre s sS
*Aphysical Address i needed to
main memoX cce SS
Qcce SS hthe

Sp- CP enevades a
logical address Censisting
o oo
ting
age Humber Spcciies h
Speilie of
oce ss from Shich Pa3 he
cpU Jans o rcad
cad thc
he
Page o idset Specifies -th Spectic vd on h e

hat CP 9antS4o Cad

St2 fes Ah pag Humber gunehd bthe cp


aa Table ovderthe CoreS onding me
Yome
HamberCba addyess othe Ome) ohehat
t d an the mam meme

Sp-3
Th ame numbrCombined caithth Oageofsc
amá th qutdphytical address.
Fams number Spefie ame OhcR
Aerd. hetquied
Page o4se Spccis the Speciie LOesd
erd thathad
hat hos
b rad rom a t page

CPu-
Local Addvess
Franc Hoofsen
Phyical Addms

PT BR

n -iume
Paeabe Rretr (PTBR)
Table
kPage gble a data Ctuoc.
able AA stoved n jhe man memo
*Each oces a i oom Ande pemdtny 91ai
*
P18R Conhcins he ba addrers oo page
gblo
corkina

Raferenced Page Ho

PTBR {- PSam He
Pagc lle 8t Register

Page Table

PTGR P>ouidos the bat Addres ot Page table


Th ba addres o 4h
page dable
oh he addcd
page tl4mbes
eenced by the cPu.
4 he Cnt o4 he ge
g Aable Con
he am number Canhimiy
lgim
Lohee he
tnceel
ha3A oxtd
*lage Tble Enta
A Pa ablk CnB CantainM AvYal antos mahon
gbout he paR
T èn{ovmation n Ah pa Agble
nty Varic om opcathng Symo OS.
OS.
PhosA mpos ant intormation àn a
GM s ame numbcr

Fame P-ckAbaun Protechom Re hene


Cachina
Humber

apional Fiold
compuls
Field
ma,
r n mm®
Phybcal Addess Spacc =Size ofMmn
Size of Pm ToBal Ho o
om Page ize
Fame Size age Size
Ho. o emc in M 2 4hen
Ho of bits
pame no. y bit
Pag Size 2 ytS, thun
Ho. o4 bis n
paq ofscr =x bi tS.
Si2 MM =2 byes, hen
Ho: of bitts n phyical Addhess x bis
Ler Proce
Virtual Addrs5 Space Size o PoceSs
o o Paqehe ocess is
diyided =Pvocess Size
Page ize
proceSS Size es 4hun
no o bisn uirtual
addre s Space bi4g

Size of Page Gk ambey o} onthicS in


Gble
Page x ge
CntisànPeq qblc
cnty12
Ho o pages 4
Pa
PaHable
abk cny 12 i dinded
No.
Ho. oo. i+8
bi+8 Àn
An ame
is md fov same Ho Mo c
Opaiona eliar
acticesoblem Baatd on
Pging and Pa Talile'
oblem. -
Calcula he Si2e o} memaA if i
qdd ConsisS o 22 bi an +he nemo
- byt qddrtsSablo .

Soh haue
Number oj locaions possitle ith g2biks
2ocations

T S2 o On locahon -2 bitC

Ths Si2c mcmo

Size at Memory 2n x Size ot one ocahon

22
x 2

ns

oblem Calculadt the no o bits quned in 4he


addr ss me mo hai Si26 of 1 Ge.
AsSumc the Memoru is 4-byt addrttsable
&o -Le n' umbu e bis ane equec

Si2c oo Meme
2x4 bs
4 bks16 mB
x4 1 G
h

2x4 934

2" 32

nz 32 6its|

You might also like