0% found this document useful (0 votes)
46 views

Cache Memory and Mapping

1. Cache memory is a small, fast memory located between the CPU and main memory that stores frequently accessed instructions and data from main memory to reduce average memory access time and improve performance. 2. When the CPU needs to access memory, the cache is examined first. If the requested data is found in cache (a hit), it can be read quickly from cache. If not found (a miss), it must be read from slower main memory and stored in cache. 3. There are different mapping techniques used to determine how data is stored in cache memory, including direct mapping, set-associative mapping, and fully-associative mapping.

Uploaded by

Harika
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Cache Memory and Mapping

1. Cache memory is a small, fast memory located between the CPU and main memory that stores frequently accessed instructions and data from main memory to reduce average memory access time and improve performance. 2. When the CPU needs to access memory, the cache is examined first. If the requested data is found in cache (a hit), it can be read quickly from cache. If not found (a miss), it must be read from slower main memory and stored in cache. 3. There are different mapping techniques used to determine how data is stored in cache memory, including direct mapping, set-associative mapping, and fully-associative mapping.

Uploaded by

Harika
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Cache memobty *

1f he active Potions of tns and dota ave


proqra
Placed in a Fast Small memo he avevaqe memo
acces time Can be Yedu ced, tus Yeducin total
Execuhem time of he pyoam. Such a fast Snall
memoy is refemed to a aa Coche
memoy
Plaed betoee tua CPU and nain me mony
Cocne
memoy a cces time 1S less than t
aCces time o
maun memony ya factey of 5to lo.
opeYaiom of tuu Cache is a fo lloss
CPU eedS to acce
memony , t h Cache
S Eamined.

*dfH wond is FoUnd in t Cache, i S Tead


Yomhe tast me
Coond addvesSed by the CPOiS not
tound n he Coche h a main me mo S accene
to rea d the
A Block
Cwonds Containin the One Just
aCcesed is trans ferred frm man
nemoy o
Coche memo
Tus BloCk S 2e
may Vary rem
P
abot
wcnds adjace to tu ne
vs+acene d.
In hiS
mamne Y, Some dcda are tràutemed
So tha*
Cache
urure Yeteven cEs
memol ind tue
Yequived aond S
Cacha memoJ
>jsPertonance of Cache nemoJ s frequent
Called hi} rako.
meaured in tevmS of a quantiy
and inds he
when the Cpo YeferS memo
Said tod Prodoce a hit
wond n coche, }is
iS in mouy
Wold is not foond in Cache, +
J f fhe

memoy and 4 Counds miss.

raio of Hhe tmbey of hi+S divided by tne

o4al CPO referen ces to memoy ( h+s PAus msses)i

he ht Yoho

h i t Yatio is bet mealured expevimcotall, by


n the Compuey and
represemBattive ProqramS
unnin*
meas udinM te um be ofhi tS and miSses duyin
aven inleval of time
lotally Jhe ingumatenu
Jempeual
ea
Mappin
rom moin
rasfornatim of dala
Deinihon: Te
magping
iS
refexre to a a
memony to Cache memony

Process
here are
Jn the Cache memoNy Orqani zaim,

Cxists
hee tpes of mapping Procedures

Associaive mappin
2 Digect mappi
3 Set- ASSociaive mapfid
technique), ConsideY
For 11uraim of thee mapfn
as ghown
O Specifc narmpie of a memony Osqani2ahon

below

Main memo
CpU
32-K X 12
Cache
miaO

Earngle of CoChinemoy

>Jaa main memoy Can Stone 32k wond s of 2 bis each

TuCach iS Capable 51 of nese cons

0n 9ive n tme
Fo Cach wod SaJed in Cache, here is a dupica e
CoPi t maun mimo
CpU Communicales w t c mt movie:
ASsociaive
moPfin
and
ASSeciahve memonM
memoay SOsed fo s Pabtest
vnost lei ble Cache Organizoien
in tis Cae, tu Associakve memay Stone both
OddreSs dnd Content (dada) f t memo7 t0ond.

- T iolotoin
diagram ShotoS three wOmds that
ave stted in
Cache.
CPU adàves (is bits)

Arqorewt Reqsle
Ade Dcta

O100o 3450
6410
21345 23

A PU address o 5 bits is placed in tee

umet YegisteY and he aMociatve mimo is

SeaChed fon a matching addres


P Hhe addres is found,the Coresfondinq 12- bit

data Yead and Sent to the CPU


3 malch 1S OCCUn he aun hnemun

O.ccessed, fon e wOnd

T addye-data paix
9ociathve Co Chi VnmoT

CaceS ui, an ftodres-oleua place mu


be Yepla ccd witha neu Piy Mosly FFo AlGomik iS
censive. Cuwn (anh
SSocialive memo HeS

RAm
he Cache iS
k Possi bikty of using a RM o)
Shen beloto
6bits
7o 7nde

009

octal Coch memory


OcHaR
maun mrmo addve Addyes: 1 biS
adarek
Addres 15 bis 27 afa: n bi1S.
ala 12 bts

14tial-3

is divided in to hoo elds


memo14
neny addroy

Ta, Jndex.
Uses t h m-bit
Tus dyect mappm Cache orgoni2otion

memo74
And the k-bi
addes accey

index to acce the Cachi

Of tue wonds
OYqoni2ai oy
nievna

in he tollowing
me moY
Shou
Cache

dic rm,

CP.TC)
addre
Brdes
obs 1 Daia
120

o9 240
olo0o 3450

45 60
02000 590 (b)Coch rs ne n.

(a) main 6210


Mum
ya Eoch wond I CoCh ConsiSts of t dala

ond and 4S asocaled

ne ond is p boust in o Cach


bi4S are Stoned along sih tha data bits.

wnn t CPU Geneyales a mimolYeuest, A


indey keld s Use tone addresS to acce
CoC.

in e CPU ad dress iS Conpased

in he wond Yead 4ron Cache


->f uooags match, hwo Hha 7s Said to be
hit and Teuirtd daa tword S in Cochi.

no madch, thrn } i s a miSS. and

e equived cnd s Yead fsCmme mc

Conider numeri cal &emple. apaigdirec


OYqOn zatjon.
J
(OoNd a addre zeo 1s prebenHly Stoned i

Cach

dex 00o a9e 00 data -22.0


Supfose that he CPO nou dans to acceM Hh wond
ak adoves 0000
u ndex ad dress, Jndex osed to
= o00 So 1+ iS
acces to Coche
>T too toqs are tun Compaled
T e Cach
tag iS 00 bu tw addve% +aq is 02-, tohiCn
does not produce a matCh.
7hEretone the main nemoy Sacceue and tu dota
wond 56t0 iS ransfered to tw CPU.
Tus Cace cwond a index addre O00 S tan
Yeplaccd wit a
a9 of 02 and data of 56+0o.
CreGt mapPin
Cache wh Bloc Size of & locnds
> T Same
037qomi 2ahon bu osing a block Si2e of3 wods is
O Shouwn
eloo.
Jndea Dafa
34 50 63
Ta Cleck cna
65 8
Olo
ndei

6H

Haq held Stned wlhin tu Cache is Conm m to all


e i t wodS of tu Same block
n tniS +ratio wi inprove itth a lage bloce. Size.
3 SeAssociative Mopgin
l disacdyanhoge of direc mapping
Oddres but
wondS w t he Same in dex in heiv

in u e
with dffevent tog vaues Camnot YeBide

Cach emony at the Some ime

TiS Se-asociative ma ppin is an npsovemeut

to e divect moping onqonizahiom, in tohich ech i d

Stone two wondS oF


Of Cache Can oY mone

mem
o UndeY ths Sane index addrey.

Fach dala womd S stoned toget.ev i HS tag

TUa numbeY of Hadada items in one wod

of Cache 1s Called as a Se'.

An onple of a sel ASsociahve CoCh rqmi2atio


d
set Si2e of two S Shown elow.

Jnde jos Data TOg Dato


O00 O 3450 0 5640

C 6+10 00 2340

Tuo-o SeX aocialive na Pin CaCA


dala oond S
refeys to two
tach index addres
and neiy aayo Cialed
Has and Sach daBa
oond hos
Each 6 6LHS
toq Yeguives
2 bitS. So t wond longh = al6+12= =3 bi#S
T above quve Shocs hat, tua toonds Sthnedat
Aqwe
addresses ol000 and 02o oo of maln memoy are

Stoted in Ca che memoy ad Hu Same index addres


000.
Simlaly, hu wond S at addrene 079 and
00444 ave Stoned addhers
in Cacha at index 7*
m o m e set- aoci ahve iS ivem becaune, tue
COngariSim e dome m ttag ValueA is Simila
to an amociaive mem ony Seach.

Advomtos Hi+ Taho impoves a He Se Size in Creaje).

DiSadvom tas: an Cyea)e in Se Si2e, n Cveaes numbeY


in t Omds which yesuts to mone Conple
Caynpa Siom loiC

Hing t Cock
>whe the CPU md S a oon in Cache durinq
Yead
operahn, t mam memomy iS not
Invowed in
he traster.

B, if he operatim is a
Oofi te, Hheve AYe toO

Sa, mat Sytem Can


prOC<ed
wtle-rough
w e -ba ck.

wnite- hroush ntiS, maim mfmo y is


P da ed evePTy meng7y e opevahen aleng t

You might also like