Professional Documents
Culture Documents
Allocation of Frames
Allocation of Frames
l
ocat
ionoff
rames:
Animpor tantaspectofoperati
ngsyst
ems, v
irt
ualmemoryisimpl
ement edusi
ngdemand
paging.Demandpagi ngnecessi
tat
esthedevel
opmentofapage-r
eplacementalgor
ithm and
aframeal locat
ionalgorit
hm.Frameal
locat
ionalgori
thmsar
eusedifyouhav emult
iple
processes; i
thelpsdecidehowmanyframest oall
ocatet
oeachprocess.
Therearev ar
iousconst rai
ntstothest r
ategiesfortheal l
ocationoff rames:
Youc annotal l
ocatemor ethant hetotalnumberofav ailableframes.
Atl eastami nimum numberoff r
amesshoul dbeal l
ocat edt oeachpr ocess.Thi
s
constraintissupportedbyt woreasons.Thef i
rstreasoni s,
asl essnumberoff rames
areall
ocat ed,therei
sani ncreaseint hepagef aultrati
o, decreasingtheperfor
mance
oftheexecut ionoftheprocess.Secondl y,t
hereshoul dbeenoughf r
amest oholdall
thedifferentpagesthatanysi ngleinstr
ucti
oncanr eference.
Frameallocati
onal gorit
hms–
Thetwoal gori
thmscommonl yusedt oallocatefr
amest oapr ocessar e:
GlobalvsLocalAll
ocat
ion–
Thenumberoff ramesall
ocat
edtoaprocesscanalsodynami
cal
l
ychangedependi
ngon
whetheryouhaveusedglobalr
epl
acementorlocal
repl
acementf
orr
eplaci
ngpagesincase
ofapagef aul
t.
Ot
heri
mpor
tantt
opi
caskedi
npr
evi
ousy
earquest
ionpaper
(shor
tnot
es)
:
Q.
1wr
it
eshor
tnot
e“OSasResour
ceManger
”.
Whenacomput erhasmul t
ipl
euser s,t heneedformanagi ngandpr otectingthememory,I
/O
devicesandot herdevi
cesisev engr eater
.
Thepr imar ytaskofOSi stokeept rackofwhoi susingwhi chr esour ce,tograntr
esour
ce
requests,t
omedi ateconfli
cti
ngrequest sfrom di
ff
erentprogramset c.
Usersof tenneedt oshar
enotonl yhardwar e,buti
nfor
mat i
on(Fil
e,Database)aswel l.
Whi
chI
ncl
udesi
nResour
ceManager?
Resour
cemanagementi
ncl
udesmul
ti
plex
ingr
esour
cesi
n2way
s,t
heyar
e
1.I
nTime
2.I
nSpace
WhenResour
cei
sTi
meMul
ti
plexed
WhenResour
cei
sSpaceMul
ti
plexed
Mainmemor yisnormallydivi
dedupamongsev eralrunningpr
ograms
OSassumeenoughmemor ytoholdmulti
pleprograms
OSholdsev eralprogr
amsi nmemor yatonceinsteadofcompl et
ingonebyone.
Theissuesoff ai
rness,prot
ecti
onandsoonwi llsolv
ebyOS.
Harddiskisanot herr
esourcemanagerforspacemul ti
plexed
Q.
2wr
it
eshor
tnot
e“ker
nel
”.
AKer nel i
sacomput erpr
ogr am thatisthehear tandcor eofanOper ati
ngSy stem.Si
ncethe
Oper at i
ngSy stem hascontrol overthesystem so, t
heKer nelalsohascontrolover
everyt hinginthesy st
em.Itist hemosti mpor tantpartofanOper ati
ngSystem.Whenev era
system st arts,theKernel
isthef irstprogram thatisloadedafterthebootl
oaderbecausethe
Kernel hastohandl etherestoft hethingofthesy stem fortheOperati
ngSy stem.TheKernel
remai nsi nthememor yuntiltheOper ati
ngSy stem isshut-
down.
TheKernel
isresponsi
blef
orl
ow-level
taskssuchasdiskmanagement,memory
management,taskmanagement,
etc.I
tprovi
desani nt
erf
acebet
weentheuserandthe
har
dwarecomponent soft
hesystem.Whenapr ocessmakesarequestt
otheKernel
,theni
t
i
scall
edSystem Call
.
AKerneli
sprovi
dedwit
hapr ot
ectedKernelSpacewhichisaseparat
eareaofmemor yand
t
hisareai
snotaccessi
blebyotherappl
icat
ionprogr
ams.So,thecodeoftheKernel
is
l
oadedint
othisprot
ect
edKernelSpace.Apartf
rom thi
s,t
hememor yusedbyother
appl
i
cat
ionsiscal
ledtheUserSpace.Asthesear
etwodi
ff
erentspacesi
nthememor
y,so
communicat
ionbetweenthem i
sabitsl
ower .
Funct
ionsofaKer
nel
Fol
l
owi
ngar
ethef
unct
ionsofaKer
nel
:
AccessComput
err
esour
ce:
AKer
nel
canaccessv
ari
ouscomput
err
esour
cesl
i
ket
he
CPU, I/
Odev icesandotherr esources.Itact
sasabr i
dgebetweentheuserandthe
resour cesoft hesyst
em.
Re sour ceManagement :Itisthedut yofaKer nelt
osharetheresourcesbet
ween
variouspr ocessinsuchawayt hatthereisunif
orm accesstotheresour
cesbyever
y
process.
Me mor yManagement :Everypr ocessneedssomememor yspace.So,memorymust
beal locatedanddeallocatedf orit
sexecut i
on.Allt
hesememor ymanagementis
donebyaKer nel.
De viceManagement :Theper i
pheral devi
cesconnectedinthesystem ar
eusedbythe
processes.So, t
heall
ocat i
onoft hesedev i
cesismanagedbyt heKer nel
.
Q.3wri
teshor tnote“spooling”
.
SPOOLi sanacr onymf orsimultaneousper i
pheral
operationson-
li
ne.
Iti
sakindofbuf
fer
ing
mechanism orapr ocessi nwhichdat aistemporari
lyheldtobeusedandexecutedbya
devi
ce,program orthesy stem.Datai ssenttoandst or
edi nmemoryorothervol
ati
l
e
stor
ageunt i
ltheprogram orcomput errequest
sitforexecuti
on.
I
nacomput ersystem per i
pheralequipments,suchaspr i
ntersandpunchcar dr eader setc
(batchpr ocessing),arev eryslow r el
ati
vetot heper for
manceoft herestoft hesy stem.
Gettinginputandout putf r
om thesy stem wasqui cklyseent obeabot tl
eneck.Her ecomes
theneedf orspool.Spoolingwor kslikeatypicalrequestqueuewher edata,instr
uct ionsand
processesf r om mul t
iplesourcesar eaccumul atedf orexecuti
onl at
eron.Gener all
y,itis
maint ai
nedoncomput er’
sphy sicalmemor y,buf fersort heI/O devi
ce-
speci f
ici nterrupt
s.
Thespooli spr ocessedi nFIFOmanneri .
e.what ev erfir
stinstr
ucti
onist hereint hequeue
will
bepoppedandexecut ed.
Appli
cati
ons/ I
mpl ementationsofSpool :
1)Themostcommoncanbef oundinI/Odev icesli
kekey boardprinter
sandmouse.For
example,Inpr i
nter,thedocument s/
fil
esthatar esenttot heprint
erar efirststor
edi nthe
memor yort hepr i
nterspool er
.Oncet heprinteri sr
eady,itfet
chest hedataf rom thespool
andprintsit
.
Evenexper i
encedasi tuationwhensuddenl yf orsomesecondsy ourmouseorkey board
stopswor ki
ng?Meanwhi le,weusuallycli
ckagai nandagai nher eandt her
eont hescreento
checkifitswor ki
ngornot .Wheni tactual
lyst artsworki
ng,whatandwher everwepr essed
duri
ngi t
shangst ategetsexecut edv er
yfastbecauseal ltheinstr
uctionsgotst or
edi nthe
r
espect
ivedev
ice’
sspool
.
2)Abatchprocessi
ngsy
stem usesspooli
ngt
omai ntai
naqueueofready
-to-
runj
obswhi
ch
canbestar
tedassoonasthesystem hast
heresour
cestopr
ocessthem.
3)Spooli
ngiscapabl
eofoverl
appingI
/Ooperat
ionf
oronej
obwi
thprocessoroper
ati
onsfor
anot
herjob.i.
e.mult
ipl
eprocessescanwrit
edocumentst
oaprintqueuewi t
houtwai
ti
ng
andresumewiththei
rwork.
4)E-
mail
:anemai
lisdeli
ver
edbyaMTA(Mai
lTransf
erAgent
)toat
empor
aryst
oragear
ea
wher
eitwai
tst
obepickedupbytheMA(
Mail
UserAgent
)