Home Техника Система за съхранение

Система за съхранение



Въведение

Системата за съхранение е една от най-важните части на компютъра. Системата за съхранение предоставя възможност за записване и четене на информация (програми и данни), необходима на компютъра за постигане на функцията за памет на информацията на компютъра. Архитектура на съхранение на няколко нива на регистри, кеш, основна памет и външна памет се използва модерни компютърни системи.

Thecoreofacomputerstoragesystemismemory,whichisanindispensablememorydeviceusedtostoreprogramsanddatainacomputer.

Вътрешната памет (памет за кратко) съхранява главно програми и данни, необходими на компютъра за текуща работа, включително високоскоростна кеш памет (кеш, кеш за кратко) и основна памет. В момента основният компонент на паметта е полупроводникова памет. методи: магнитно съхранение, оптично съхранение и полупроводниково съхранение. Носителите за съхранение включват твърди дискове, оптични дискове, ленти и мобилно съхранение.

Themulti-levelstoragearchitectureofmoderncomputersystemsisshowninFigure6-1.Thehigherthetop,theclosertotheCPU,thefasterthememory,thesmallerthecapacity,andthehigherthepriceperbit.Usingthisorganizationmethodcanbettersolvethecontradictionbetweenstoragecapacity,speedandcost,andprovidealayerofstoragethatislogicallyequivalenttothecheapestinpriceandcapacity,andtheaccessspeedisclosetothefastestinthestoragesystem.Storagesystemoflayeredmemory.

Development

Ifthecomputer'sexternalstoragesystemhasbeendevelopedsince1956whenIBMproducedthefirstharddisk,ithasbeendevelopedformorethanhalfacentury.Inthepasthalfcentury,storagemediaandstoragesystemshaveachievedgreatdevelopmentandprogress.

Intheearlydaysofdatastorage,devicessuchasdiskarraysweregenerallyusedasperipherals,andtheserversweredirectlyconnectedforstorage.Inrecentyears,withthedevelopmentofnetworktechnology,thedatareadingrangeoftheserverhasalsobeengreatlyexpanded,graduallyrealizingthecurrentnetworkstorage.Comparedwithtraditionalstorage,theadvantagesofnetworkstoragearemoreprominent.Itisnotonlyconvenienttoinstallandlowincost,butalsoabletoexpandstoragedevicesonalargescale,thuseffectivelymeetingthestoragespacerequirementsofmassivedatastorage.However,networkstorageconsumesalotofnetworkresources,whichisadifficultproblem.Forthisreason,SANstoragearchitecturegraduallyappeared.

Традиционна система за съхранение

В момента има три основни архитектури на традиционни системи за съхранение, включително DAS, NAS и SAN.

1.DAS(Директно прикачено хранилище,Директно прикачено хранилище)

Asthenameimplies,thisisastoragemethodinwhichstoragemediasuchasharddisksaredirectlyconnectedtothehostthroughabusadapter.Thereisusuallynonetworkequipmentinvolvedbetweenthestoragedeviceandthehost.ItcanbesaidthatDASisthemostprimitiveandbasicstoragearchitecture,anditisalsothemostcommononpersonalcomputersandservers.TheadvantagesofDASareitssimplestructure,lowcost,andhighefficiencyofreadingandwriting.Thedisadvantageisthatithaslimitedcapacityandisdifficulttoshare,whichmakesiteasytoform"informationislands."

2.NAS (мрежово съхранение, мрежова система за съхранение)

NASisanetworkstoragesystemthatprovidesfile-levelaccessinterfaces,usuallyusingnetworkfilessuchasNFS,SMB/CIFS,etc.Sharingagreementforfileaccess.NASsupportssimultaneousaccessbymultipleclientsandprovidesalarge-capacitycentralizedstoragefortheserver,whichalsofacilitatesdatasharingduringtheserviceperiod.

3.SAN(StorageAreaNetwork,storageareanetwork)

Setupadedicatedstoragenetworkbetweenserversandstoragedevicessuchasdiskarraysthroughhigh-speednetworkequipmentsuchasfiberswitchestoprovidehighperformanceStoragesystem.

ThedifferencebetweenSANandNASisthatitprovidesablock-levelaccessinterface,andgenerallydoesnotprovideafilesystematthesametime.Undernormalcircumstances,theserverneedstomaptheSANstoragetoalocaldiskthroughanaccessprotocolsuchasSCSI,anduseitaftercreatingafilesystemonit.Atpresent,mainstreamenterprise-levelNASorSANstorageproductscangenerallyprovideTB-levelstoragecapacity,andhigh-endstorageproductscanalsoprovideuptoseveralpetabytesofstoragecapacity.

Distributedstoragesystem

Bigdatahasledtoanexplosivegrowthintheamountofdata.Traditionalcentralizedstorage(suchasNASorSAN)can’tperformwellintermsofcapacityandperformance.Meettheneedsofbigdata.Therefore,distributedstoragewithexcellentscalabilityhasbecomethemainstreamarchitectureforbigdatastorage.Distributedstoragemostlyusesordinaryhardwareequipmentastheinfrastructure,sothestoragecostperunitcapacityisalsogreatlyreduced.Inaddition,distributedstoragealsohasdifferentdegreesofadvantagesintermsofperformance,maintainability,anddisastertolerance.

Thekeytechnicalissuesthatadistributedstoragesystemneedstosolveincludescalability,dataredundancy,dataconsistency,globalnamespacecaching,etc.Fromanarchitecturalpointofview,distributedstoragecanbedividedintoTherearetwotypes:C/S(ClientServer)architectureandP2P(Peer-to-Peer)architecture.Ofcourse,therearealsosomedistributedstoragesystemswherethesetwoarchitecturesexistatthesametime.

Anothercommonproblemfacedbydistributedstorageishowtoorganizeandmanagemembernodes,andhowtoestablishthemappingrelationshipbetweendataandnodes.Thedynamicincreaseordepartureofmembernodescanbasicallyberegardedasanormalstateinadistributedsystem.

TheCAPtheoryofdistributedsystemdesignproposedbyEricBrewerin2000pointedoutthatadistributedsystemcannotguaranteethethreeelementsofconsistency,availability,andpartitiontoleranceatthesametime.Therefore,anydistributedstoragesystemcanonlyoptimizetwoofitselementstothegreatestextentbasedonitsspecificbusinesscharacteristicsandspecificneeds.Ofcourse,inadditiontothethreedimensionsofconsistency,availability,andpartitiontolerance,adistributedstoragesystemoftenhasdifferenttrade-offsinfeaturedesignaccordingtospecificservices,suchaswhetheritneedsacachemoduleandwhetheritsupportscommonfiles.Systeminterface,etc.

Cloudstorage

Cloudstorageisanonlinestoragesystemprovidedbythird-partyoperators,suchasonlinestoragesystemsforindividualusersandfile,blockorobjectstoragesystemsforenterprises,etc..Cloudstorageoperatorsareresponsibleforthedeployment,operation,andmaintenanceofdatacenters,andprovidedatastoragepackagestocustomersintheformofservices.Asoneoftheextensionsandimportantcomponentsofcloudcomputing,cloudstorageprovidesdatastorageservicesof"distributionondemandandbillingbyvolume".Therefore,usersofcloudstoragedonotneedtobuildtheirowndatacentersandinfrastructure,nordotheyneedtocareaboutthemanagementandmaintenanceoftheunderlyingstoragesystem,andcandynamicallyexpandorreducetheirdemandforstoragecapacityaccordingtotheirbusinessneeds.

Cloudstorageusesoperatorstocentrallyanduniformlydeployandmanagestoragesystems,whichreducesthecostofdatastorage,therebyloweringthebarrierstoentryforthebigdataindustry,andhelpingsmallandmedium-sizedenterprisestoenterthebigdataindustry.Providespossibilities.Forexample,thewell-knownonlinefilestorageserviceproviderDropboxisbasedontheonlinestoragesystemS3providedbyAWS(AmazonWebServices).Beforetheriseofcloudstorage,itwasalmostimpossibletostartastartuplikeDropbox.

Thestoragesystemsusedbehindcloudstorageactuallymostlyusedistributedarchitecture,andcloudstoragehasalsoencounterednewproblemsandrequirementsindesignduetoitsmorenewapplicationscenarios.Forexample,cloudstoragemostlyneedstosolvehowtosupportmulti-tenantaccessinthemanagementsystemandaccessinterface.Inamulti-tenantenvironment,itisinevitabletosolveaseriesofproblemssuchassecurityandperformanceisolation.Inaddition,cloudstorageisthesameascloudcomputing.Acommonproblemthatneedstobesolvedistheissueoftrust—howtotechnicallyensuretheprivacyandsecurityofenterprisebusinessdataonthethird-partystorageserviceproviderplatform.Itisatechnicalchallengethatmustbesolved.

Storageisprovidedtousersintheformofservices,andcloudstoragegenerallyadherestothecharacteristicsofsimplicityandeaseofuseintheaccessinterface.Forexample,Amazon'sS3storageaccessesdatathroughastandardHTTPprotocolandasimpleRESTinterface.UsersuseHTTPmethodssuchasGet,Put,andDeletetoobtain,store,anddeletedatablocks.Forthesakeofeaseofoperation,AmazonS3servicedoesnotprovideoperationssuchasmodificationorrenaming;atthesametime,AmazonS3servicedoesnotprovideacomplexdatadirectorystructurebutonlyprovidesaverysimplehierarchicalrelationship;userscancreatetheirownDatabucket(bucket),andalldataisstoreddirectlyinthisbucket.Inaddition,cloudstoragehastosolvetheproblemofusersharing.ThedatainAmazonS3storageisdirectlyaccessedandidentifiedthroughauniqueURL.Therefore,aslongasotherusersareauthorized,theycanaccessthroughtheURLofthedata.

Storagevirtualizationisanimportanttechnicalfoundationofcloudstorage.Itisatechnologythatunifiesmultipleisolatedstoragesystemsintoanabstractresourcepoolbyabstractingandencapsulatingthephysicalcharacteristicsoftheunderlyingstoragesystem.Throughstoragevirtualizationtechnology,cloudstoragecanachievemanynewfeatures.Forexample,thelogicalisolationofuserdata,thestreamlinedconfigurationofstoragespace,etc.

Hierarchicalstructure

Thehierarchicalstructureofthestoragesystemcanbedividedintofivelevels:registerset,cache,mainmemory,virtualmemoryandexternalmemory.Amongthem,theregistergroupisalwaysinsidetheCPU,andtheprogrammercanaccessitthroughtheregistername.Thereisnobusoperation,andtheaccessspeedisthefastest;theremaining4levelsarealloutsidetheCPU.Cacheandmainmemoryconstitutetheinternalstoragesystem,andtheprogrammercanaddressthroughthebus.Theaccessspeedofthememoryunitisworsethanthatoftheregister;thevirtualmemoryistransparenttotheprogrammer;theexternalstoragesystemhasalargecapacityandneedstoexchangedatawiththeCPUthroughtheI/Ointerface,andtheaccessspeedistheslowest.

Кеш памет

Оригиналното значение на кеш паметта (Cache) се отнася за тип RAM, който е с по-висока скорост на достъп от общата памет с произволен достъп (RAM). Най-общо казано, не се използва технология за динамична памет с произволен достъп (DARM) като основната памет на системата, а е скъпа, но по-бърза статична памет с произволен достъп ( SRAM) технология.

Thehigh-speedbuffermemoryisaprimarymemorybetweenthemainmemoryandtheCPU.Itiscomposedofastaticmemorychip(SRAM).Ithasasmallcapacitybutamuchfasterspeedthanthemainmemory.ItsmostimportantindicatorIsitshitrate.Theschedulingandtransferofinformationbetweenthecachememoryandthemainmemoryareautomaticallyperformedbythehardware.

Структура на състава

Thecachememoryismainlycomposedofthefollowingthreeparts:

  1. Банка на кеш паметта: Съхранявайте инструкциите и данните, прехвърлени от основната памет.Система за съхранение

  2. Компонент за преобразуване на адрес: Създайте таблица с директории, за да преобразувате адреса на основната памет в главния адрес на кеша.

  3. Замяна на компонент: Когато кеш паметта е пълна, извършете замяна на данни в съответствие с определена стратегия и променете таблицата с директории в компонента за транслация на главна адрес.

Принцип на работа

High-speedmemoryisusuallycomposedofhigh-speedmemory,Lenovomemory,replacementlogiccircuitandcorrespondingcontrolcircuitcomposition.Inacomputersystemwithacachememory,theaddressoftheprocessortoaccessthemainmemoryisdividedintothreefields:rownumber,columnnumber,andgroupaddress.Therefore,themainmemoryislogicallydividedintoseveralrows:eachrowisdividedintoseveralmemorycellgroups;eachgroupcontainsseveralordozensofwords.High-speedmemoryisalsodividedintorowsandcolumnsofmemorycellgroupsaccordingly.Bothhavethesamenumberofcolumnsandthesamegroupsize,butthenumberofrowsinthehigh-speedmemoryismuchsmallerthanthatinthemainmemory.

Lenovomemoryisusedforaddressassociationandhasstorageunitswiththesamenumberofrowsandcolumnsashigh-speedmemory.Whenamemorycellgroupinacertaincolumnandrowofthemainmemoryistransferredtoanemptymemorycellgroupinthesamecolumnofthehigh-speedmemory,thememorycellcorrespondingtotheLenovomemoryrecordstherownumberofthetransferredmemorycellgroupinthemainmemory.

Whentheprocessoraccessesthemainmemory,thehardwarefirstautomaticallydecodesthecolumnnumberfieldoftheaccessaddress,soastocombinealltherownumbersoftheLenovomemorywiththerownumberofthemainmemoryaddressFieldsarecompared.Iftheyarethesame,itindicatesthatthemainmemoryunittobeaccessedisalreadyinthehigh-speedmemory,whichiscalledahit.Thehardwaremapstheaddressofthemainmemorytotheaddressofthehigh-speedmemoryandexecutestheaccessoperation;iftheyarenotthesame,thenIndicatesthattheunitisnotinthehigh-speedmemory,whichiscalledfailure.Thehardwarewillperformtheoperationofaccessingthemainmemoryandautomaticallytransferthemainmemorycellgroupwheretheunitislocatedintotheemptymemorycellgroupinthesamecolumnofthehigh-speedmemory.TherownumberofthegroupinthemainmemoryisstoredintheunitatthecorrespondinglocationoftheLenovomemory.

Whenafailureoccursandthereisnoemptypositioninthecorrespondingcolumnofthehigh-speedmemory,acertaingroupinthecolumniseliminatedtomakeroomforthenewlytransferredgroup,whichiscalledreplacement.Therulesfordeterminingreplacementarecalledreplacementalgorithms.Commonlyusedreplacementalgorithmsincludeleastrecentlyusedalgorithm(LRU),first-infirst-outmethod(FIFO),andrandommethod(RAND).Thereplacementlogiccircuitperformsthisfunction.Inaddition,whenperformingawriteoperationtothemainmemory,inordertomaintaintheconsistencyofthecontentsofthemainmemoryandthehigh-speedmemory,thehitsandfailuresarehandledseparately.

Присвояване на адреси и преобразуване

Addressmappingreferstothecorrespondencebetweentheaddressofacertaindatainthemainmemoryandtheaddressinthecacherelation.Herearethreeaddressmappingmethods:

1.Напълно асоциативен метод

Theaddressmappingruleofthefully-associatedmethodis:anypieceofthemainmemorycanbemappedtotheCacheAnypiece.Thebasicrealizationideais:1)Themainmemoryandthecachearedividedintodatablocksofthesamesize;2)Acertaindatablockofthemainmemorycanbeloadedintoanyspaceofthecache.

ThedirectorytableisstoredinLenovomemoryandconsistsofthreeparts:theblockaddressofthedatablockinthemainmemory,theblockaddressafterstoringitinthecache,andtheeffectivebit(alsocalledtheloadbit).Sinceitisafullyassociativemethod,thecapacityofthedirectorytableshouldbethesameasthenumberofblocksinthecache.

Theadvantageofthefullassociativemethodisthatthehitrateisrelativelyhigh,andtheCachestoragespaceutilizationrateishigh;thedisadvantageisthatwhenaccessingtherelatedmemory,itmustbecomparedwiththeentirecontenteverytime,andthespeedislowandthecostishigh.Lessapplications.

2. Директен асоциативен метод

TheaddressmappingruleofthedirectassociativemethodisthatablockinthemainmemorycanonlybemappedtoaspecificblockintheCache.Thebasicrealizationideais:

1)Основната памет и кешът са разделени на блокове с данни с еднакъв размер;

2)Themainmemorycapacityshouldbeanintegermultipleofthecachecapacity,andthemainmemoryspaceDivideintoareasaccordingtothecachecapacity,thenumberofblocksineachareaof​​themainmemoryisequaltothetotalnumberofblocksinthecache;

3)AblockofthemainmemorycanonlybestoredinthecachewhenitisstoredinthecachePositionwiththesameblocknumber.

Datablockswiththesameblocknumberineachareaof​​themainmemorycanbetransferredtotheaddresswiththesameblocknumberinthecache,butonlyoneblockcanbestoredinthecacheatthesametime.Sincethetwofieldsofthemainblocknumberandthecacheblocknumberandtheaddressintheblockarecompletelythesame,onlytheareacodeofthetransferredblockcanberecordedwhenthedirectoryisregistered.Thedirectorytableisstoredinhigh-speedandsmall-capacitymemory,andincludestwofields:theareanumberofthedatablockinthemainmemoryandtheeffectivebit.Thecapacityofthedirectorytableisthesameasthenumberofcachedblocks.

Theadvantageofthedirectassociativemethodisthattheaddressmappingmethodissimple.Whenaccessingdata,youonlyneedtocheckwhethertheareacodeisequal,soyoucangetfasteraccessspeedandsimplehardwareequipment;thedisadvantageisthereplacementoperationFrequent,thehitrateisrelativelylow.

3.Метод на групово-асоциативно картографиране

Theaddressmappingruleofthegroup-associativemappingmethodisthatablockinthemainmemorycanonlybestoredinanyblockofthesamegroupnumberinthecache.Thebasicrealizationideais:

1)Основната памет и кеш паметта са разделени на блокове според еднакъв размер;

2)Основната памет и кеш паметта са разделени на групи според еднакъв размер:

3)Themainmemorycapacityisanintegermultipleofthecachecapacity.Themainmemoryspaceisdividedintoareasaccordingtothesizeofthecachearea.Thenumberofgroupsineachareaof​​themainmemoryisthesameasthenumberofgroupsinthecache;

4)Whenthedatainthemainmemoryistransferredtothecache,thegroupnumbersofthemainmemoryandthecacheshouldbeequal,thatis,ablockineachareacanonlybestoredinthespaceofthesamegroupnumberinthecache,buttheblocksinthegroupcanbearbitrarilyStorage,thatis,thedirectmappingmethodisadoptedfromthegroupinthemainmemorytothegroupinthecache:afullyassociativemappingmethodisadoptedinthetwocorrespondinggroups.

Theconversionbetweenthemainmemoryaddressandthecacheaddressconsistsoftwoparts:thegroupaddressadoptsthedirectmappingmethodandisaccessedbyaddress;whiletheblockaddressadoptsthefullyassociativemethodandisaccessedbycontent.

Theadvantageofthegroupassociativemappingmethodisthatthecollisionprobabilityoftheblockisrelativelylow,theutilizationrateoftheblockisgreatlyimproved,andthefailurerateoftheblockissignificantlyreduced:thedisadvantageisthatthedifficultyandcostofimplementationarehigherthanthatofthedirectmappingmethod..

Memory

Memory(Memory),alsoknownasinternalmemoryormainmemory,ismadeofsemiconductordevices.ItisoneoftheimportantpartsofacomputerandisdirectlyaddressablebytheCPU.Thestoragespaceischaracterizedbyfastaccessspeed.Allprogramsinthecomputerareruninthememory,sotheperformanceofthememoryhasagreatimpactonthecomputer.ThefunctionofthememoryistotemporarilystorethearithmeticdataintheCPUandthedataexchangedwithexternalstoragesuchasharddisks.Aslongasthecomputerisrunning,theCPUwilltransferthedatathatneedstobecalculatedintothememoryforcalculation,andwhenthecalculationiscompleted,theCPUwilltransmittheresult.

Theprogramsweusuallyuse,suchasWindowsoperatingsystem,typingsoftware,gamesoftware,etc.,aregenerallyinstalledonexternalstoragesuchasharddisks,buttheirfunctionscannotbeusedalone.TheymustbeinstalledOnlywhenitisloadedintothememorytorun,canwereallyuseitsfunctions.Weusuallyenteraparagraphoftextorplayagame,infact,itisalldoneinthememory.Justlikeinastudyroom,thebookshelvesandbookcasesstoringbooksareequivalenttotheexternalstorageofthecomputer,andthedeskwhereweworkisthememory.Usuallywestorealargeamountofdatatobestoredpermanentlyonexternalmemory,andputsometemporaryorasmallamountofdataandprogramsinthememory.Ofcourse,theperformanceofthememorywilldirectlyaffecttheoperatingspeedofthecomputer.

Паметта включва два вида памет само за четене (ROM) и памет с произволен достъп (RAM).

Памет само за четене (ROM)

Паметта само за четене е ROM (ReadOnlyMemory)). Когато ROM е произведен, информацията (данни или програма) се съхранява и постоянно се съхранява. Информацията може само да се чете, не се записва и данните няма да бъдат загубени, дори ако машината е изключена. ROM обикновено се използва за съхраняване на основни компютърни програми и данни, като BIOSROM. физическият вид обикновено е интегриран блок с дуалин-линия (DIP).

RandomAccessMemory(RAM)

RandomAccessMemoryisRAM(RandomAccessMemory),whichmeansthatdatacanbereadfromorwrittento.Whenthepowerofthemachineisturnedoff,thedatastoredinitwillbelost.Thememorymodule(SIMM)thatweusuallybuyorupgradeisusedasthecomputer'smemory.ItisasmallcircuitboardthatintegratestheRAMintegratedblockandplugsitintothememoryslotinthecomputertoreducetheRAMintegratedblockoccupancySpace.

Finallyintroducethetwoconceptsofphysicalmemoryandstorageaddressspace.Theyaretwodifferentconcepts,butbecausethereisaverycloserelationshipbetweenthetwo,andtheybothuseB,KB,MB,andGBtomeasuretheircapacity,itiseasytocauseconfusion.Physicalmemoryreferstoaspecificmemorychipthatactuallyexists.Forexample,thememorybarinstalledonthemotherboardandtheROMchiploadedwiththesystemBIOS,thedisplayRAMchiponthedisplaycardandtheROMchiploadedwiththedisplayBIOS,andtheRAMchipsandROMchipsonvariousadaptercardsareallphysicalmemories.Thestorageaddressspacereferstotherangeofmemoryencoding(encodingaddress).Theso-calledencodingistoassignanumbertoeachphysicalstorageunit(abyte),usuallycalled"addressing".Thepurposeofassigninganumbertoastorageunitistofinditeasilyandcompletethereadingandwritingofdata.Thisistheso-called"addressing",sosomepeoplealsocallthestorageaddressspaceaddressingspace.

Thesizeofthestorageaddressspaceandthesizeofthephysicalmemoryarenotnecessarilyequal.Letmegiveanexampletoillustratethisproblem:Thereare17roomsonafloor,andtheirnumbersare801~817.These17roomsarephysical,andtheiraddressspaceusesathree-digitcode,rangingfrom800to899,atotalof100addresses.Itcanbeseenthattheaddressspaceislargerthantheactualnumberofrooms.Formicrocomputersabove386,theaddressbusis32bits,sotheaddressspacecanreach2B,thatis,4GB.

Енергонезависима памет (NVM)

Thenon-volatilememory(Non-Volatilememory,NVM)thathasappearedinrecentyearsischaracterizedbyitshighintegrationFeaturessuchashighspeed,lowenergyconsumption,non-volatility,andbyteaddressinghavereceivedwidespreadattention.Academiaandindustryhavedevelopedsomenewnon-volatilestoragemediaandtechnologies,suchasMagneticRAM(MRAM),SpinTransferTorqueRAM(STT-RAM),andPhaseChangeMemory(PhaseChangeMemory,PCM),resistiveRAM(RRAM),ferroelectricRAM(FerroelectricRAM,FeRAM),etc.Themainparametersofseveralmainstreamnewstoragedevicesarelistedinthetable.Itcanbeseenfromthetablethatnon-volatilestoragehasgoodperformanceintermsofintegrationandreadspeed,andisacandidateforconstructingpotentialnewstoragedevices.However,non-volatilestoragealsohasseveralobviousshortcomings:1)Ithasalargewritedelay,whichisanorderofmagnitudelargerthanthecorrespondingstoragemedium,andthewritedelayisgreaterthanthereaddelay,thatis,readandwriteareinconsistent.2)Althoughthereadoperationofnon-volatilestorageisfasterthanthewriteoperation,itisstillslowerthanthereadoperationoftraditionalstoragemedia;3)Thewritelifeofnon-volatilestorageislimited.Inthecaseofcontinuouswriting,thestorageunitisveryItwillsoonexpire.

Disk

Diskisthemostcommonlyusedexternalstorage.Itisaroundmagneticdiskpackedinasquaresealedbox.ThepurposeofthisistopreventthediskThesurfaceisscratched,causingdataloss.Thedatainformationstoredonthediskcanbestoredforalongtimeandcanbeusedrepeatedly.Disksaredividedintofloppydisksandharddisks.Atpresent,floppydiskshavebeenbasicallyeliminated.Computerswidelyuseharddisks.Wecancompareittoalargewarehouseforcomputerstostoredataandinformation.

Видове и състав на твърдите дискове

ThetypesofharddisksmainlyincludeSCSI,IDE,andthepopularSATA.Therearecertainstandardsfortheproductionofanykindofharddisk.Withtheupgradeofthecorrespondingstandard,theharddiskproductiontechnologyisalsoupgrading.Forexample,theSCSIstandardhasgonethroughSCSI-1,SCSI-2andSCSI-3.Atpresent,weoftenvisitthewebsiteTheUltral-160seenbytheserverisbasedontheSCSI-3standard.IDEfollowstheATAstandard,andthecurrentpopularSATAisanupgradedversionoftheATAstandard.IDEisaparallelportdevice,whileSATAisaserialport.SATAwasdevelopedtoreplaceIDE.

Най-общо казано, без значение какъв вид твърди дискове, той се състои от диск, глава, шпиндел, контролен двигател, контролер на главата, конвертор на данни, интерфейс, кеш и т.н.

TheharddiskstructureisshowninFigure2-6.Alldiscsarefixedonarotatingshaft,whichisthediscspindle.Allthediscsareabsolutelyparallel.Thereisamagneticheadonthestoragesurfaceofeachdisc,andthedistancebetweenthemagneticheadandthediscissmallerthanthediameterofthehair.Alltheheadsareconnectedtoaheadcontroller,andtheheadcontrollerisresponsibleforthemovementofeachhead.Themagneticheadcanmoveradiallyalongtheradiusofthedisc(actuallyitisanobliquetangentialmovement).Eachmagneticheadmustalsobecoaxialatthesametime,thatis,whenviewedfromdirectlyabove,allmagneticheadsoverlapatalltimes(However,thereisalreadyamulti-headindependenttechnology,whichisnotsubjecttothislimitation).Thediscrotatesatahighspeedataspeedofthousandsofrevolutionsperminutetotensofthousandsofrevolutionsperminute,sothatthemagneticheadcanreadandwritedataataspecifiedlocationonthedisc.

Принципът на работа на твърдите дискове

1.Повърхност на диска

Thedisksofharddisksgenerallyusealuminumalloymaterialsasthesubstrate,high-speedharddisksItisalsopossibletouseglassasthesubstrate.Eachdiskofaharddiskhastwosides,namelytheupperandlowersides.Generally,eachsidewillbeusedtostoredataandbecomeaneffectivedisksurface.Therearealsoveryfewharddiskswithoddnumberofsides.Eachsucheffectivediskhasadisknumber,whichisnumberedsequentiallyfromtoptobottom,startingfrom0.Intheharddisksystem,thedisksurfacenumberisalsocalledtheheadnumber,becauseeachvaliddisksurfacehasacorrespondingreadandwritehead.Thedisksetofharddiskshas2to14platters,usually2to3platters,sothediskfacenumber(headnumber)is0~3or0~5.

2.Проследяване

Thediskisdividedintomanyconcentriccirclesduringlow-levelformatting.Theseconcentriccircletracksarecalledtracks,andinformationisrecordedonthesetracksintheformofpulsetrains.middle.Thetracksarenumberedsequentiallyfromtheoutsidetotheinside,startingfrom0.Eachharddiskhas300~1024tracksoneachsurface,andthenewlarge-capacityharddiskhasmoretracksoneachsurface.Eachtrackdoesnotrecorddatacontinuously,butisdividedintosegmentsofarcs.Theangularvelocitiesofthesearcsarethesame,butbecausetheradiallengthisdifferent,thelinearvelocityisalsodifferent.Thelinearvelocityoftheouterringishigherthanthatoftheinnerring.Thelinearvelocityislarge,thatis,underthesamerotationspeed,thelengthofthearcdrawnbytheouterringinthesameperiodoftimeisgreaterthanthelengthofthearcdrawnbytheinnerring.Eacharciscalledasector,andsectorsarenumberedstartingfrom1,andthedataineachsectorisreadorwrittenasaunitatthesametime.Thetracksareinvisible,justsomemagnetizedareasonthedisksurfacethataremagnetizedinaspecialway,andtheplanninghasbeencompletedwhenthediskisformatted.

3.Цилиндър

Thesametrackonalldisksformsacylinder,usuallycalledacylinder.Themagneticheadoneachcylindergoesfromtoptobottomandfrom0Startnumbering.Datareading/writingisperformedonacylinder,thatis,whentheheadreads/writesdata,theoperationstartsfromhead0inthesamecylinder,andthenoperatesondifferentdisksurfacesofthesamecylinder,thatis,thehead,onlyinthesamecylinder.Afterallthemagneticheadsonthesurfacehavebeenread/written,themagneticheadtransferstothenextcylinder(thecylinderthatisconcentricandtheninward),becausetheselectionofthemagneticheadonlyneedstobeswitchedelectronically,andtheselectionofthecylindermustbemechanicallySwitching,thespeedoftheheadmovingtotheadjacenttrackduringelectronicswitchingismuchfasterthanthatduringmechanicalswitching.Therefore,datareading/writingisperformedonthecylinderinsteadofthedisksurface,therebyimprovingtheread/writeefficiencyoftheharddisk.

Thenumberofcylindersofaharddiskdrive(orthenumberoftracksperdisk)dependsonthewidthofeachtrack(alsorelatedtothesizeofthehead),andalsodependsonthepositioningmechanismThesizeofthestepbetweentracks.

4.Сектор

Theoperatingsystemstoresinformationontheharddiskintheformofsectors(Sector).Eachsectorincludestwomainparts:sectoridentifierandstorageThedatasegmentofthedata(usually512B).

Идентификаторът на сектора, наричан също заглавка на сектора, включва три числа, които образуват триизмерния адрес на този сектор: 1) Номер на диск: главата (или дискът), където е разположен секторът 2) Номер на цилиндър: Следа, определяща радиалната посока на главата: 3) Номер на сектора: Позицията на пистата, наричана още номер на блок, който определя позицията на dataonthediskcircle.

Thesectorheaderalsoincludesafield,inwhichthereisamarkthatidentifieswhetherthesectorcanreliablystoredata.Someharddiskcontrollersalsorecordpointersinthesectorheader,whichcandirectthedisktoareplacementsectorortrackwhentheoriginalsectoriswrong.Finally,thesectorheaderendswithacyclicredundancycheck(CRC)value,sothatthecontrollercancheckthereadoutofthesectorheadertoensureaccuracy.

Thedatasegmentofasectorisusedtostoredatainformation,includingdataanderrorcorrectioncodes(ECC)fordataprotection.Duringtheinitialpreparation,thecomputerfills512virtualinformationbytes(thestoragelocationoftheactualdata)andtheECCnumberscorrespondingtothesevirtualinformationbytesintothispart.

Принцип на достъп

Стек

Стекът е пространство за записване на пътя и параметрите на извикване, когато програмата на езика се изпълнява: включително рамката за извикване на функцията, параметрите за предаване и запазването на адреса за връщане и предоставянето на пространство за локална променлива.

Основни познания за стека

1. Регистри, свързани със стека

1)esp:указателят на върха на стека;

2)ebp:baseaddresspointer(ebpisusedtorecordthecurrentfunctioncallbaseaddressinLanguage);

3)cs:eippointstotheaddressofthenextinction,има два случая;

(1)Последователно изпълнение:винаги сочи къмследващата инструкция с последователни адреси;

(2) Прескачане/разклоняване: Когато такава инструкция се изпълни, стойността на cs:eip ще бъде модифицирана според нуждите на програмата;

4)call:pushthecurrentvalueofcs:eipontothetopofthestack,cs:eippointstotheentryaddressoftheвикналата функция;

5)ret:Popthevalueofcs:eiporginallylydheremedherfromthetopofthestackandputitintocs:eip;

6)iret:Popthecs:eipandflagsпървоначално съхранени тук отгоре на стойността на стека,putitincs:eipandflagregister.

2.Операция на стека

1)push:показателят в горната част на стека е намален с 4 байта (32 бита):

2) изскачане: точката в горната част на стека е увеличена с 4 байта (32 бита).

Използването на стека по време на извикването на функция

TheoperationofthestackduringthefunctioncallisshowninFigure3.AmainfunctioncallsaForsub-functions,thespecificstepsofthecallingprocessaredescribedasfollows:

  1. Преди да се изпълни извикването, esp сочи към горната част на стека и debp сочи към дъното на стека;

  2. Когато повикването се изпълни, първоначалната стойност на cs:eipis се записва в горната част на стека и след това стойността на cs:eip посочва на адреса за въвеждане на извиканата програма;

  3. Въведете извиканата програма,първата инструкция:pushl%ebp,втората инструкция:movl%esp,%ebp;

  4. Въведете извиканата програма и след това стекът може да бъде бутнат в стека и т.н. Нормална работа;

  5. Излезте от извиканата програма, първата инструкция ismovl%ebp, %esp, втората инструкция е popl%ebp, а третата инструкция е върната.

Принципът на флокалност

Принципът на флокалност се отнася до това, до което се осъществява достъп, когато процесорът има достъп до паметта, независимо дали става въпрос за инструкция или достъп до данни.

Местността обикновено има две форми:

Временна локалност: Ако не бъде осъществен достъп до информационен елемент, има вероятност да бъде достъпен отново в близко бъдеще. Програмни цикли, стекове и т.н. са причината за временна локалност.

Spatiallocality:Theinformationthatwillbeusedinthenearfutureislikelytobeclosetotheinformationcurrentlyinuseinthespatialaddress.

Alllevelsofmoderncomputersystems,fromhardwaretooperatingsystems,toapplications,aredesignedusingtheprincipleoflocality.Atthehardwarelevel,theprincipleoflocalityallowscomputerdesignerstosaverecentlyreferencedinstructionsanddataitemsbyintroducingasmallandfastcachememory,therebyincreasingthespeedofaccesstothemainmemory.Attheoperatingsystemlevel,thelocalityprincipleallowsthesystemtousemainmemoryasthemostrecentlyreferencedcacheinthevirtualaddressspace.Thelocalityprinciplealsoallowsthesystemtousethemainmemorytocachethemostrecentlyuseddiskblocksinthediskfilesystem.Theprincipleoflocalityalsoplaysanimportantroleinthedesignofanapplication.Forexample,aWebbrowserplacesarecentlyciteddocumentonalocaldisk,usingtemporallocality.AlargenumberofWebserversstorerecentlyrequesteddocumentsinfront-enddiskcaches.Thesecachescansatisfyuserrequestsforthesedocumentswithoutanyinterventionfromtheserver.

Thefollowingthreeexamplesareusedtoillustratethelocalityoftheprogram'sdatareference.

Пример1:

intsumvec(intv[N])

{

inti=0,sum=0;

за(inti=0;i

{

сума+=v[i];

}

връщане;

}

Intheabovecode,thevariablesumisreferencedonceineachloopiteration,whichhastimelocality.Fortheelementsofthearrayv,theyarestoredaccordingtothemTheorderinthememoryisreadsequentially,soithasspatiallocality,buteacharrayelementisonlyaccessedonce,soithasnotemporallocality.ItcanbeseenthatthesumvecfunctionhasbothspatiallocalityandtimefordataaccessLocality.

Пример2:

intsumarrayros(intv[M][N])

{

inti=0;j=0;сума=0;

за(i=0;i

за(j=0;j

{

сума+=v[i][j];

}

връщане;

}

Intheabovecode,Theelementsofarrayvareaccessedaccordingtothestepsize1,soithasgoodspatiallocality(arrayelementsarestoredinroworder).

Пример 3:

intsumarrayros(intv[M][N])

{

inti=0;j=0;сума=0;

за(j=0;j

за(i=0;i

{

сума+=v[i][j];

}

връщане;

}

Intheabovecode,theelementsofthearrayvareaccessedaccordingtothestepsizeN,soitsspatiallocalityVerybad.Insummary,thefollowingconclusionscanbedrawn:

1) Програми, които многократно се позовават на една и съща променлива, имат добра времева локалност;

2)ForthosewithasteplengthofkTheprograminthereferencemode,thesmallerthestepsize,thebetterthespatiallocality.Theprogramthatjumpsaroundinthememorywithlargesteps,thespatiallocalitywillbepoor;

3) За извличане на инструкции С други думи, примката е с добро време и пространствена локалност.

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