Page 356 - FUNDAMENTALS OF COMPUTER
P. 356

NPP













                   356                         Fundamentals of Computers                           NPP


                     8.   H$_ _mÌm _| Cn`moJ _| bmB© OmVr h¡Ÿ&  A{YH$ _mÌm _| Cn`moJ _| bmB© OmVr h¡Ÿ&
                     9.   H$moB© `m§{ÌH$ {hñgo Zht hmoVo h¢Ÿ&  Bg_| `m§{ÌH$ {hñgo hmoVo h¢Ÿ&
                    10.   g_mZm§Va S>mQ>m Q´>m§g\$a hmoVm h¡Ÿ&  loUr _| S>mQ>m Q´>m§g\$a hmoVm h¡&
                    11.   h_oem aoÝS>_ EŠgog hmoVr h¡Ÿ&        gr[a`b `m AY© aoÝS>_ EŠgog hmoVr h¡Ÿ&
                   4.10 Cache Memory                          4.10 Ho$e _o_moar
                      “A  cache  memory  is a fast  and very      ""`h EH$ CÀM J{V go H$m`© H$aZo dmbr, bo{H$Z
                  expensive memory placed in between CPU and  AË`{YH$ _h±Jr, AY©MmbH$ _o_moar h¡, Omo {H$ CPU Am¡a
                  main memory to increase the overall speed of  _oZ _o_moar Ho$ _Ü` bJr hmoVr h¡ Ÿ&"" Bggo H$åß`yQ>a Ho$
                  program execution.” Normally the size of cache  àmoJ«m_ {H«$`mÝd`Z H$s J{V ~‹T>mVo h¢ Ÿ& _h±Jr hmoZo Ho$ H$maU
                  memory is very small  in a computer  system,
                  because of its cost  factor. The  access time  of  Bgo H$_ _mÌm _| bJmVo h¢& BgH$m EŠgog Q>mB©_ ~hþV H$_
                  cache  is very low.  The aim  of  any  caching  hmoVm h¡Ÿ& Bg àH$ma go Omo {gñQ>_ ~ZVm h¡, Cgo Ho$qeJ
                  system is  to achieve highest speed  with the  {gñQ>_ H$hVo h¢Ÿ& Bg {gñQ>_ H$m CÔoí` hmoVm h¡, H$_-
                  lowest cost. Large amount of main memory is  go-H$_ IM© _| A{YH$ go A{YH$ J{V àmßV H$aZmŸ& _oZ
                  used because it has a moderate price. By using  _o_moar H$s H$s_V H$_ hmoZo go BgH$s _mÌm Vmo A{YH$ aIr
                  small  amount  of cache and certain algorithm  OmVr h¡Ÿ& H$_ _mÌm _| Ho$e H$m Cn`moJ H$aHo$ Bg Vah
                  an engineer wants to achieve the speed of cache.  go J{V àmßV H$aZo H$s H$mo{ee H$aVo h¢ O¡go gånyU© _o_moar
                  This memory is based on the  principle of   hr Ho$e hmoŸ& `h bmoHo${bQ>r (ñWmZr`Vm) Am°\$ [a\$a|g
                  Locality  of Reference,  which tells that  in a  Ho$ {gÕm§V na H$m`© H$aVr h¡Ÿ& `h {gÕm§V ~VmVm h¡ {H$
                  short interval of time CPU tends to reference a
                  small portion of memory area.               {H$gr g_` _| CPU, _o_moar Ho$ EH$ N>moQ>o go joÌ H$mo hr
                                                              àmßV H$a nmVm h¡&
                      Principle of Locality of Reference: It has  bmoHo${bQ>r Am°\$ [a\$a|g H$m {gÕm§V: Eogm XoIm
                  been seen that in a large program  CPU      J`m h¡ {H$ {H$VZm ^r ~‹S>m àmoJ«m_ hmo, EH$ {ZpíMV g_`
                  references are  confined in a small  portion of
                  memory area. This principle is called locality  _| CPU Bg ~‹S>o àmoJ«m_ Ho$ EH$ N>moQ>o go joÌ na hr AnZm
                  of reference. For example, consider a simple  H$m`© H$a nmVm h¡& Bgr VÏ` H$mo bmoHo${bQ>r Am°\$ [a\$a|g
                  program with no loops. This program is      H$m {gÕm§V H$hVo h¢Ÿ& O¡go `{X EH$ Eogm àmoJ«m_ h¡, {Og_|
                  executed sequentially.  If  line number  A con-
                  taining  an  instruction is referenced,  then the  H$moB© byn Zht h¡, Vmo `h H«$_~Õ gånÞ hmoJmŸ& `{X EH$
                  next reference will  be  to line  number  A + 1.  H$WZ Omo {H$ bmB©Z Zå~a A na h¡, EŠgrŠ`yQ> hmo ahm
                  Now consider the programs containing loops  h¡, Vmo AJbm H$WZ A + 1 dmbm hr gånÞ hmoJmŸ& `{X
                  and procedures. If CPU is entered to execute a
                  loop then  the  references made by  CPU are  àmoJ«m_ _| byn ^r h¡Ÿ& O¡go \$m°a byn h¡ Vmo N>moQ>o g_m`m§Va
                  confined in  a  memory area where  the loop  _| CPU byn Ho$ AÝXa Ho$ H$WZ hr àmßV H$aVm ahoJmŸ&
                  resides. Similar is the case with the procedures.  `hr ~mV àmo{gOa d \§$ŠeZ Ho$ {bE ^r gË` h¡Ÿ&
                      The programs and data which are needed      Eogo hr àmoJ«m_ d S>mQ>m {OZH$m CPU H$mo ~ma-~ma
                  frequently, are  kept in a  cache memory. The  H$m_ n‹S>Vm h¡, Ho$e _o_moar _| aI {XE OmVo h¢ & _oZ _o_moar
                  access time of memory is lower by a factor of 5  Ho$ gmnoj Ho$e _o_moar H$m EŠgog Q>mB©_ 5 go 10 JwZm
                  to 10 as compared to main memory. If a very
   351   352   353   354   355   356   357   358   359   360   361