Home Technique Virtual memory

Virtual memory



Function

ThefunctionofvirtualmemoryThememoryplaysaveryimportantroleinthecomputer.Alltheprogramsrunninginthecomputerneedtobeexecutedthroughthememory.Iftheexecutionoftheprogramislargeormany,thenWillcausethememorytorunout.Inordertosolvethisproblem,thevirtualmemorytechnologyisusedinWindows,thatis,apartoftheharddiskspaceisusedasmemory.Whenthememoryisoccupied,thecomputerwillautomaticallycalltheharddiskasthememorytorelievethetensionofthememory.Forexample,ifthecomputerhasonly128MBofphysicalmemory,whenreadingafilewithacapacityof200MB,arelativelylargevirtualmemorymustbeused.Afterthefileisreadbythememory,itwillbestoredinthevirtualmemoryfirst.Afterwaitingforthememorytostoreallthefilesinthevirtualmemory,thefilesstoredinthevirtualmemorywillbereleasedtotheoriginalinstallationdirectory.

Settings

Thevirtualmemorysettingsmainlysettwopointsforvirtualmemory,namelymemorysizeandpaginglocation,memorysizeistosettheminimumandmaximumvirtualmemory;andpagingThelocationistosettheharddiskspaceinthepartitionthatthevirtualmemoryshoulduse.Forthememorysizesetting,howtogettheminimumandmaximumvalues?Youcangetitbythefollowingmethod:select"Start→Programs→Accessories→SystemTools→SystemMonitor"(ifnotinthesystemtools,youcaninstallitthroughtheWindowsinstallerin"Add/RemovePrograms")toopenthesystemmonitor,Andthenselect"Edit→AddItem",select"MemoryManagementProgram"inthe"Type"item,andselect"SwapFileSize"inthelistontheright.Inthisway,asyouoperate,thefluctuationoftheexchangefilevaluewillbedisplayed.Youcanopenthefrequentlyusedprograms,andthenusethem,thenchecktheperformancevalueinthesystemmonitor,becausetheusereverytimeThesituationwhenusingacomputerisdifferent.Therefore,itisbesttomonitortheswapfileforalongtimetofindthevaluethatbestmatchesyourswapfile,soastoensurestablesystemperformanceandkeepitinthebeststate.Afterfindingthemostsuitablerangevalue,whensettingthevirtualmemory,right-click"MyComputer"andselect"Properties"topopupthesystempropertieswindow,selectthe"Performance"tab,andclickthe"VirtualMemory"buttonbelowtopopupInthevirtualmemorysettingwindow,clickthe"Usersspecifyvirtualmemorysettings"radiobutton,selectthepartitionwithlargerfreespacefor"HardDisk",andthenentertheappropriaterangevalues​​inthe"Minimum"and"Maximum"textboxes.Ifyoufinditalittletroublesometousethesystemmonitortogetthemaximumandminimumvalues,youcanchoose"LetWindowsmanagevirtualmemorysettings"here.

Adjustthepagingposition

ThevirtualmemorypagingpositionofWindows9xisactuallyavirtualmemoryfile(alsoknownastheswapfile)Win386.swpsavedintherootdirectoryoftheCdrive.Itsstoragelocationcanbeanypartition.IfthecapacityofsystemdiskCislimited,wecantransferWin386.swptoanotherpartitionbyopeningtheSystem.ini(underC:\Windows)fileinNotepad.Inthe[386Enh]section,change"PagingDrive=C:WindowsWin386.swp"tothepathofotherpartitions.IfyouputtheswapfileinD:,changeitto"PagingDrive=D:Win386.swp",suchasYoucantypeitdirectlywithouttheabovestatement.ForWindows2000andWindowsXP,youcanselect"Settings→Advanced→Change"in"ControlPanel→System→Advanced→Performance"toopenthevirtualmemorysettingwindow,andthesystemisselectedbydefaultinthedrive[volumelabel]Ifyouwanttochangethepartitionwhereitislocated,youmustfirstsettheoriginalpartitiontonopagingfile,andthenselectotherpartitions.

Ifyourharddiskislargeenough,pleaseopen"System"in"ControlPanel",open"VirtualMemory"inthe"Performance"option,andselecttheseconditem:user-definedThevirtualmemorysettingpointstoalessusedharddisk,andsetsthemaximumandminimumvalues​​toafixedvalue,whichisabouttwicethesizeofthephysicalmemory.Inthisway,whenthevirtualmemoryusestheharddisk,itdoesnotneedtoaccommodatethedifferencebetweenlargeandsmall,butusesafixedspaceasthevirtualmemorytospeeduptheaccessspeed.Thesettingofvirtualmemoryisbestperformedafter"diskdefragmentation",sothatthevirtualmemoryisdistributedinacontinuous,non-fragmentedfilespace,whichcanplayabetterrole.

Useskills

Virtualmemoryuseskills

Fortheproblemofhowtosetvirtualmemory,Microsofthasprovideduswithanofficialsolution.Forgeneralcases,Werecommendthefollowingsettingmethod:

(1)SetthepagefileonthepartitionwheretheWindowssystemislocated.Thesizeofthefileisdeterminedbyyoursystemsettings.Thespecificsettingmethodisasfollows:Openthe"Properties"settingwindowof"MyComputer",switchtothe"Advanced"tab,andinthe"Writedebugginginformation"columnofthe"StartupandRecovery"window,ifyouuse"None"",setthepagefilesizetoabout2MB.Ifyouuse"corememorystorage"and"fullmemorystorage",setthepagefilevaluetoalargervalue,whichisalmostthesameasphysicalmemory.

Smalltip:Thereisacontradictionbetweenwhethertosetthepagefileinthesystempartition:ifitisset,thesystemmayfrequentlyreadthispartofthepagefile,therebyincreasingtheloadonthetrackwherethesystemdiskislocated,butIfitisnotset,whenthesystemhasabluescreenofdeath(especiallyaSTOPerror),thedumpfile(Memory.dmp)cannotbecreated,soprogramdebugginganderrorreportingcannotbeperformed.Sothecompromiseistosetasmallerpagefileonthesystemdisk,aslongasitisenough.

(2)Createaseparateblankpartition,setvirtualmemoryinthepartition,theminimumvalueissetto1.5timesthephysicalmemory,themaximumvalueissetto3timesthephysicalmemory,thepartitionisdedicatedtostoragePagefile,donotstoreanyotherfiles.Thereasonwhyaseparatepartitionisusedtosetvirtualmemoryismainlybasedontwoconsiderations:First,becausetherearenootherfilesonthepartition,thepartitionwillnotgeneratediskfragments,whichcanensurethatthedatareadandwriteofthepagefileisnotaffectedbythedisk.Fragmentationinterference;second,accordingtoWindows'memorymanagementtechnology,Windowswillgiveprioritytotheuseofthepagefileonthepartitionthatisnotfrequentlyaccessed,whichalsoreducesthechanceofreadingthepagefileinthesystemdisk,Whichreducesthepressureonthesystemdisk.

(3)Nopagefileissetforotherharddiskpartitions.Ofcourse,ifyouhavemultipleharddrives,youcancreateapagefileforeachharddrive.Whentheinformationisdistributedonmultiplepagefiles,theharddiskcontrollercanperformreadandwriteoperationsonmultipleharddisksatthesametime.Inthisway,thesystemperformancewillbeimproved.

Reminder:

Theminimumvalueofvirtualmemorythatcanbesetis2MB,andthemaximumvaluecannotexceedtheremainingspaceofthecurrentharddisk,anditcannotexceedthememoryaddressingrangeofthe32-bitoperatingsystem.--4GB.

Related

Virtualmemory

virtualmemory

Atypeofstorageusedtoprovideuserswithgreaterrandomaccessspacetechnology.Itusesacombinationofmemoryandexternalmemory.Itseemsthatthereisaninternalmemorywithahugecapacity.Theworkingspeedisclosetothatofthemainmemory,andthecostperbitissimilartothatoftheauxiliarymemory,formingamulti-levelstoragesysteminthewholemachine.

Thesourceofthevirtualmemorycomesfromtheconceptofthefirst-levelmemoryoftheBritishATLAScomputer.Themainmemoryofthissystemisa16Kwordmagneticcorememory,butthecentralprocessingunitcanaddressthemainmemorywitha20-bitlogicaladdress.By1970,theAmericanRCAcompanysuccessfullystudiedvirtualmemorysystems.IBMfullyadoptedvirtualstoragetechnologyontheIBM370systemin1972.Virtualmemoryhasbecomeaveryimportantpartofcomputersystems.

Virtualstorageisautomaticallyrealizedbythehardwareandoperatingsystemtoscheduleandmanagestorageinformation.Itsworkingprocessconsistsof6steps:①Thelogicaladdressofthecentralprocessingunit'saccesstothemainmemoryisdecomposedintogroupnumberaandgroupaddressb,andthegroupnumberaisconvertedtotheaddress,thatis,thelogicalgroupnumberaisusedasanindex,andtheaddressconversionischecked.Tabletodeterminewhetherthegroupofinformationisstoredinthemainmemory.②Ifthegroupnumberisalreadyinthemainmemory,goto④;ifthegroupnumberisnotinthemainmemory,checkwhetherthereisafreeareainthemainmemory,ifnot,transferatemporarilyunusedgrouptosendTotheauxiliarystorage,inordertotransferthisgroupofinformationintothemainstorage.③Readthedesiredgroupfromtheauxiliarystorageandsendittothefreeareaof​​themainstorage,andthenregisterthefreephysicalgroupnumberaandlogicalgroupnumberaintheaddressconversiontable.④Readthephysicalgroupnumberacorrespondingtothelogicalgroupnumberafromtheaddressconversiontable.⑤Getthephysicaladdressfromthephysicalgroupnumberaandthebyteaddressbinthegroup.⑥Accessnecessaryinformationfromthemainmemoryaccordingtothephysicaladdress.

Therearethreetypesofschedulingmethods:paged,segmented,andpaged.Pageschedulingistodividethelogicalandphysicaladdressspaceintofixed-sizepages.Themainmemoryisnumberedinpageorder,andeachindependentlyaddressedprogramspacehasitsownpagenumbersequence.Byschedulingthepagesoftheprogramintheauxiliarymemory,thepagesoftheprogramcanbediscretelyloadedintodifferentpagepositionsinthemainmemory.Correspondingretrieval.Theadvantageofpageschedulingisthatthefractionofpagesinthepageissmall,thepagetableistransparenttotheprogrammer,theaddresschangesquickly,andtheloadingoperationissimple;thedisadvantageisthateachpageisnotanindependentmoduleoftheprogram,anditisinconvenienttoprotecttheprogramanddata.Segmentschedulingistodividetheaddressspaceaccordingtothelogicalstructureoftheprogram.Thelengthofthesegmentisarbitraryandallowedtoextend.Itsadvantageisthatiteliminatesmemoryfragments,iseasytoimplementstorageprotection,andisconvenientforprogramdynamicassembly;thedisadvantageisthattheloadingoperationiscomplicated..Combiningthesetwomethodsconstitutessegmentpagescheduling.Insegmentpagescheduling,thephysicalspaceisdividedintopages,theprogramissegmentedbymodules,andeachsegmentissubdividedintopagesassmallasthephysicalspacepage.Segmentpageschedulingcombinestheadvantagesofsegmentandpagescheduling.Thedisadvantageisthatitincreasesthecostofthehardwareandthesoftwareismorecomplicated.Mostlargegeneral-purposecomputersystemsusesegmentpagescheduling.

Replacementmethod

Randomalgorithm

Usesoftwareorhardwarerandomnumbergeneratortodeterminethereplacementpage.

First-in-first-out

Thefirstpagetransferredtothemainmemoryisreplacedfirst.

Leastrecentlyusedalgorithm

Replacethepagesthathavenotbeenusedforthelongesttime.

VirtualandRealAddress

1.RealaddressandvirtualaddressTheaddressusedbyuserswhenprogrammingiscalledvirtualaddressorlogicaladdress,andthecorrespondingstoragespaceiscalledvirtualmemoryspaceorlogicAddressspace;theaccessaddressofthecomputer'sphysicalmemoryiscalledtherealaddressorphysicaladdress,andthecorrespondingstoragespaceiscalledthephysicalstoragespaceormainmemoryspace.Theprocessofconvertingavirtualaddresstoarealaddressbyaprogramiscalledprogramrelocation.

2.Virtualmemoryaccessprocess

Theuserprogramofthevirtualmemoryspaceisprogrammedaccordingtothevirtualaddressandstoredintheauxiliarymemory.Whentheprogramisrunning,theaddressconversionmechanismtransfersapartoftheprogramintotherealmemoryaccordingtotherealaddressspaceallocatedtotheprogramatthattime.Whenfetchingeachmemory,firstdeterminewhetherthepartcorrespondingtothevirtualaddressisinrealmemory:ifitis,thenperformaddressconversionandusetherealaddresstoaccessthemainmemory;otherwise,accordingtoacertainalgorithm,schedulepartoftheprogramintheauxiliarymemoryintoMemory,andthenaccessthemainmemoryinthesameway.Itcanbeseenthatthevirtualaddressspaceofeachprogramcanbemuchlargerthantherealaddressspace,oritcanbemuchsmallerthantherealaddressspace.Theformercaseisforthepurposeofincreasingstoragecapacity,andthelattercaseisforthepurposeofaddressconversion.Thelatterusuallyappearsinmulti-userormulti-tasksystems:therealmemoryspaceislarger,andasingletaskdoesnotrequirealargeaddressspace,andasmallervirtualmemoryspacecanshortenthelengthoftheaddressfieldintheinstruction.

Heterogeneoussystem

Fromtheconceptofvirtualmemory,itcanbeseenthattheaccessmechanismofmainmemory-auxiliarymemoryissimilartothatofcache-mainmemory.Thesearetwolevelsinathree-levelstoragesystemcomposedofcachememory,mainmemoryandauxiliarymemory.Betweencacheandmainmemoryandbetweenmainmemoryandauxiliarymemory,thereareauxiliaryhardwareandauxiliarysoftwareandhardwarerespectivelyresponsibleforaddressconversionandmanagement,sothatalllevelsofmemorycanformanorganicthree-levelstoragesystem.Cacheandmainmemoryconstitutethememoryofthesystem,andthemainmemoryandauxiliarymemoryrelyonthesupportofauxiliarysoftwareandhardwaretoformvirtualmemory.

Inthethree-levelstoragesystem,thetwostoragelevelsofcache-mainmemoryandmainmemory-auxiliarymemoryhavemanysimilarities:

(1)Thestartingpointisthesame:bothItisahierarchicalstoragesystemconstructedtoimprovetheperformance-to-priceratioofthestoragesystem.Theyalltrytomaketheperformanceofthestoragesystemclosetothehigh-speedstorage,whilethepriceandcapacityareclosetothelow-speedstorage.

(2)Theprincipleisthesame:bothusetheprincipleoflocalitywhentheprogramisrunningtotransfercommonlyusedinformationblocksfromarelativelyslowandlarge-capacitymemorytoarelativelyhigh-speedandsmall-capacitymemory.

Storagesystem

Butthetwostoragelevelsofcache-mainmemoryandmainmemory-auxiliarymemoryalsohavemanydifferences:

(1)FocusDifference:CachemainlysolvestheproblemofthespeeddifferencebetweenmainmemoryandCPU;intermsofimprovingtheperformance-priceratio,virtualmemorymainlysolvestheproblemofstoragecapacity,andalsoincludesstoragemanagement,mainmemoryallocation,andstorageprotection.(2)Thedatapathisdifferent:ThereisadirectaccesspathbetweentheCPUandthecacheandthemainmemory,andthemainmemorycanbedirectlyaccessedwhenthecachemisses;thereisnodirectdatapathbetweentheauxiliarymemoryandtheCPUonwhichthevirtualmemorydepends.Whenthemainmemoryismissed,itcanonlybesolvedbypaging,andtheCPUwilleventuallyneedtoaccessthemainmemory.

(3)Thetransparencyisdifferent:themanagementofthecacheiscompletelycompletedbythehardware,whichistransparenttoboththesystemprogrammerandtheapplicationprogrammer;whilethevirtualmemorymanagementiscompletedbythesoftware(operatingsystem)andthehardwaretogether,becausethesoftwareThevirtualstorageisnottransparenttothesystemprogrammerwhoimplementsstoragemanagement,butonlytransparenttotheapplicationprogrammer(segmentandpagemanagementare"translucent"totheapplicationprogrammer).

(4)Thelossatthetimeofamissisdifferent:theaccesstimeofthemainmemoryis5-10timesthatofthecache,andtheaccessspeedofthemainmemoryisusuallyfasterthanthatoftheauxiliarymemoryThespeedisthousandsoftimesfaster,sotheperformancelossofthesystemwhenthemainmemoryismissedismuchgreaterthanthelosswhenthecacheismissed.Thekeyproblemstobesolvedbythevirtualmemorymechanism(1)Schedulingproblem:Decidewhichprogramsanddatashouldbetransferredtothemainmemory.(2)Addressmappingproblem:Whenaccessingthemainmemory,thevirtualaddressischangedtothephysicaladdressofthemainmemory(thisprocessiscalledinternaladdressconversion);whentheauxiliarymemoryisaccessed,thevirtualaddressischangedtothephysicaladdressoftheauxiliarymemory(thisTheprocessiscalledexternaladdressconversion)inordertochangepages.Inaddition,issuessuchasmainmemoryallocation,storageprotection,andprogramrelocationmustberesolved.

(3)Replacementproblem:Decidewhichprogramsanddatashouldbetransferredoutofthemainmemory.

(4)Updateissue:Ensuretheconsistencyofmainmemoryandauxiliarymemory.

Underthecontroloftheoperatingsystem,hardwareandsystemsoftwaresolvetheaboveproblemsforusers,thusgreatlysimplifyingapplicationprogramming.

Page-basedscheduling

1.Page-basedvirtualmemoryaddressmapping

Inapage-basedvirtualstoragesystem,thevirtualaddressspaceisdividedintopagesofequallength.Theyarecalledlogicalpages;themainmemoryspaceisalsodividedintopagesofthesamesize,calledphysicalpages.Correspondingly,thevirtualaddressisdividedintotwofields:thehighfieldisthelogicalpagenumber,andthelowfieldisthepageaddress(offset);theactualmemoryaddressisalsodividedintotwofields:thehighfieldisthephysicalpagenumber,andthelowfieldisthepageInternaladdress.Thevirtualaddress(logicaladdress)canbeconvertedintoaphysicaladdressthroughthepagetable.Inmostsystems,eachprocesscorrespondstoapagetable.Thereisanentrycorrespondingtoeachvirtualmemorypageinthepagetable.Thecontentoftheentryincludestheaddress(physicalpagenumber)ofthemainmemorypagewherethevirtualmemorypageislocated,andavalidbitindicatingwhetherthelogicalpagehasbeentransferredintothemainmemory.Whentheaddressischanged,thelogicalpagenumberisusedastheoffsetaddressinthepagetabletoindexthepagetable(thevirtualpagenumberisregardedasthesubscriptofthepagetablearray)andthecorrespondingphysicalpagenumberisfound,andthephysicalpagenumberisusedasthehighfieldoftheactualmemoryaddress,Andthenspliced​​withtheoffsetinthepageofthevirtualaddresstoformacompletephysicaladdress.Moderncentralprocessingmachinesusuallyhavespecializedhardwaretosupportaddresstranslation.

2.Conversionback-upbuffer

Sincethepagetableisusuallyinthemainmemory,evenifthelogicalpageisalreadyinthemainmemory,itmustbeaccessedatleasttwiceinthephysicalmemorytoachieveoneMemoryfetch,whichwilldoubletheaccesstimeofvirtualmemory.Inordertoavoidanincreaseinthenumberofaccessestothemainmemory,asecondarycachecanbeimplementedonthepagetableitself,andthemostactivepartofthepagetableisstoredinahigh-speedmemorytoformafasttable.Thishigh-speedstorageunitdedicatedtothepagetablecacheisusuallycalledatranslationlook-asidebuffer(TLB).Thecompletepagetablestoredinmainmemoryiscalledtheslowtable.

3.Innerpagetableandouterpagetable

Thepagetableisaconversiontablefromthevirtualaddresstothemainmemoryphysicaladdress,usuallycalledtheinnerpagetable.Correspondingtotheinnerpagetableistheouterpagetable,whichisusedfortheconversionbetweenthevirtualaddressandtheauxiliarymemoryaddress.Whenthemainmemorylacksapage,thepagingoperationmustfirstlocatetheauxiliarymemory,andthestructureoftheouterpagetableiscloselyrelatedtotheaddressingmechanismoftheauxiliarymemory.Forexample,fordisks,theauxiliarystorageaddressincludesthediskdrivenumber,headnumber,tracknumber,andsectornumber.

Segmentscheduling

Segmentvirtualstoragesystem

Segmentsareareasthatcanbedynamicallychangedaccordingtothelengthoftheprogram’snaturalboundaries.Generally,programmersdividedifferenttypesofdatasuchassubroutines,operands,andconstantsintodifferentsections,andeachprogramcanhavemultiplesectionsofthesametype.Inthesegmentvirtualstoragesystem,thevirtualaddressiscomposedofthesegmentnumberandtheaddress(offset)withinthesegment.Theconversionfromvirtualaddresstorealmainmemoryaddressisrealizedthroughthesegmenttable.Eachprogramsetsupasegmenttable,andeachentryinthesegmenttablecorrespondstoasegment.Eachtableentrycontainsatleastthefollowingthreefields:(1)Validbit:Indicatewhetherthesegmenthasbeentransferredtotheactualmemory.

(2)Startaddressofparagraph:Indicatethefirstaddressoftheparagraphintheactualmemorywhentheparagraphhasbeentransferredintotheactualmemory.

(3)Lengthofsection:Recordtheactuallengthofthesection.Thepurposeofsettingthesegmentlengthfieldistoensurethatwhenaccessingtheaddressspaceofacertainsegment,theaddressinthesegmentwillnotexceedthelengthofthesegment,causingtheaddresstocrosstheboundaryanddestroyothersegments.

Thesegmenttableitselfisalsoasegment,whichcanexistinauxiliarystorage,butgenerallyresidesinmainmemory.

Segmentalvirtualmemoryhasmanyadvantages:

①Thelogicindependenceofthesegmentmakesiteasytocompile,manage,modifyandprotect,anditisalsoconvenientformulti-programsharing.

②Thesegmentlengthcanbedynamicallychangedaccordingtoneeds,allowingfreescheduling,inordertoeffectivelyusethemainmemoryspace.

Segmentalvirtualmemoryalsohassomedisadvantages:

①Becausethelengthofthesegmentisnotfixed,themainmemoryspaceallocationismoretroublesome.

②Itiseasytoleavemanyexternalfragmentsbetweensegments,resultinginadecreaseinstoragespaceutilization.

③Sincethesegmentlengthisnotnecessarilyanintegerpowerof2,itisnotpossibletosimplyusethelowestbinarybitsofthevirtualaddressandtherealaddressastheoffsetwithinthesegmentlikethepagingmethod,andcombineitwiththesegmentnumberFordirectsplicing,anadditionoperationmustbeusedtoobtainthephysicaladdressbysummingthestartaddressofthesegmentandtheoffsetwithinthesegment.Therefore,segmentstoragemanagementrequiresmorehardwaresupportthanpagestoragemanagement.

Segmentpagescheduling

Segmentpagevirtualmemoryisacombinationofsegmentvirtualmemoryandpagevirtualmemory.Theactualmemoryisdividedintopagesequally.Eachprogramissegmentedaccordingtothelogicalstructure,andeachsegmentispagedaccordingtotheactualpagesize.Theprogramiscalledinandoutbypage,butitcanbeprogrammed,protectedandsharedbysegment.Itdividestheprogramintologicalunits,andthendivideseachsectionintofixed-sizepages.Thetransferoftheprogramtothemainmemoryiscarriedoutaccordingtothepage,butitcanalsobesharedandprotectedaccordingtothesegment,andhastheadvantagesofboththepagetypeandthesegmenttype.Thedisadvantageisthatitrequiresmultipletablelookupsduringthemappingprocess.Inthesegment-pagevirtualstoragesystem,eachprogramislocatedthroughasegmenttableandasetofpagetables.Eachentryinthesegmenttablecorrespondstoasegment,andeachentryhasapagetablestartingaddresspointingtothesegmentandthecontrolprotectioninformationofthesegment.Thepagetableindicatesthepositionofeachpageofthesegmentinthemainmemory,andstatusinformationsuchaswhetherithasbeenloadedormodified.Iftherearemultipleusersrunningonthemachine,eachchannelofthemulti-programrequiresabasenumber,whichindicatesthestartaddressofthesegmenttableoftheprogram.

Theformatofthevirtualaddressisasfollows:

Basenumber

Segmentnumber

Pagenumber

In-pageaddress

Conversionalgorithm

Virtualmemoryaddressconversionbasicallyhasthreetypesofvirtualmemoryworkingprocedures:fullassociativeconversion,directconversionandgroupassociativeconversion.Thewayinwhichanylogicalspacepagecanbetransformedtoanypagepositioninphysicalspaceiscalledfullyassociativetransformation.Thewaythateachlogicalspacepagecanonlybeconvertedtoaspecificpageinthephysicalspaceiscalleddirectconversion.Groupassociativetransformationreferstodirecttransformationbetweengroups,andfullassociativetransformationbetweenpagesinagroup.Thereplacementruleisusedtodeterminewhichpartofthemainmemorytoreplace,soastovacatepartofthemainmemoryandstorethepartofthecontenttobetransferredfromtheauxiliarymemory.Thereare4commonreplacementalgorithms.①Randomalgorithm:usesoftwareorhardwarerandomnumbergeneratortodeterminethepagetobereplaced.

②First-in-first-out:Thefirstpagetransferredintothemainmemoryisreplacedfirst.

③Least-usedalgorithm:Replacethepagesthathavenotbeenusedforthelongesttime.

④Optimalalgorithm:Replacethepagethatisusedafterthelongesttime.Thisisanidealizedalgorithm,whichcanonlybeusedasastandardtomeasuretheprosandconsofvariousotheralgorithms.

Theefficiencyofvirtualmemoryisanimportantcontentofsystemperformanceevaluation.Itisrelatedtofactorssuchasmainmemorycapacity,pagesize,hitrate,programlocalityandreplacementalgorithm.

This article is from the network, does not represent the position of this station. Please indicate the origin of reprint
TOP