Úvod
Úložný systém v jedné z důležitých částí počítače. Úložný systém poskytuje možnost zapisovat a číst informace (programy a data), které počítač potřebuje k dosažení funkce paměti informací v počítači.
Thecoreofacomputerstoragesystemismemory,whichisanindispensablememorydeviceusedtostoreprogramsanddatainacomputer.
Interní paměť (zkrátka paměť) ukládá především programy a data, která počítač potřebuje pro aktuální práci, včetně vysokorychlostní mezipaměti (Cache, cache for short) a hlavní paměti. V současné době je hlavní součástí paměti polovodičová paměť. úložiště a polovodičové úložiště. Paměťová média zahrnují pevné disky, optické disky, pásky a mobilní úložiště.
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.
Tradiční úložný systém
V současné době existují tři hlavní architektury tradičních úložných systémů, včetně DAS, NAS a SAN.
1.DAS(Direct-AttachedStorage,Direct-AttachedStorage)
Asthenameimplies,thisisastoragemethodinwhichstoragemediasuchasharddisksaredirectlyconnectedtothehostthroughabusadapter.Thereisusuallynonetworkequipmentinvolvedbetweenthestoragedeviceandthehost.ItcanbesaidthatDASisthemostprimitiveandbasicstoragearchitecture,anditisalsothemostcommononpersonalcomputersandservers.TheadvantagesofDASareitssimplestructure,lowcost,andhighefficiencyofreadingandwriting.Thedisadvantageisthatithaslimitedcapacityandisdifficulttoshare,whichmakesiteasytoform"informationislands."
2.NAS(Network-AttachedStorage,networkstoragesystem)
NASisanetworkstoragesystemthatprovidesfile-levelaccessinterfaces,usuallyusingnetworkfilessuchasNFS,SMB/CIFS,etc.Sharingagreementforfileaccess.NASsupportssimultaneousaccessbymultipleclientsandprovidesalarge-capacitycentralizedstoragefortheserver,whichalsofacilitatesdatasharingduringtheserviceperiod.
3.SAN(Síť úložiště, síť úložiště)
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.
Cachememory
Původní význam mezipaměti (Cache) označuje typ RAM, který je rychlejší přístupovou rychlostí než obecná paměť s náhodným přístupem (RAM). Obecně řečeno, nepoužívá technologii dynamické paměti náhodného přístupu (DARM), jako je hlavní paměť systému (S, ale používá technologii RAM) extenzivní paměti RAM
Thehigh-speedbuffermemoryisaprimarymemorybetweenthemainmemoryandtheCPU.Itiscomposedofastaticmemorychip(SRAM).Ithasasmallcapacitybutamuchfasterspeedthanthemainmemory.ItsmostimportantindicatorIsitshitrate.Theschedulingandtransferofinformationbetweenthecachememoryandthemainmemoryareautomaticallyperformedbythehardware.
Struktura kompozice
Thecachememoryismainlycomposedofthefollowingthreeparts:
Cachememorybank: Uložte instrukce a data přenesená z hlavní paměti.
Komponenta převodu adresy: Vytvořte tabulku adresářů, abyste převedli adresu hlavní paměti na adresu hlavy cacu.
Nahradit komponentu: Když je mezipaměť plná, proveďte výměnu dat v souladu s jistou strategií a upravte tabulku adresáře v komponentě překladu hlav.
Princip práce
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.
Mapování adres a konverze
Addressmappingreferstothecorrespondencebetweentheaddressofacertaindatainthemainmemoryandtheaddressinthecacherelation.Herearethreeaddressmappingmethods:
1.Plně asociativní metoda
Theaddressmappingruleofthefully-associatedmethodis:anypieceofthemainmemorycanbemappedtotheCacheAnypiece.Thebasicrealizationideais:1)Themainmemoryandthecachearedividedintodatablocksofthesamesize;2)Acertaindatablockofthemainmemorycanbeloadedintoanyspaceofthecache.
ThedirectorytableisstoredinLenovomemoryandconsistsofthreeparts:theblockaddressofthedatablockinthemainmemory,theblockaddressafterstoringitinthecache,andtheeffectivebit(alsocalledtheloadbit).Sinceitisafullyassociativemethod,thecapacityofthedirectorytableshouldbethesameasthenumberofblocksinthecache.
Theadvantageofthefullassociativemethodisthatthehitrateisrelativelyhigh,andtheCachestoragespaceutilizationrateishigh;thedisadvantageisthatwhenaccessingtherelatedmemory,itmustbecomparedwiththeentirecontenteverytime,andthespeedislowandthecostishigh.Lessapplications.
2.Directassociativní metoda
TheaddressmappingruleofthedirectassociativemethodisthatablockinthemainmemorycanonlybemappedtoaspecificblockintheCache.Thebasicrealizationideais:
1)Hlavní paměť a cache jsou rozděleny do datových bloků stejné velikosti;
2)Themainmemorycapacityshouldbeanintegermultipleofthecachecapacity,andthemainmemoryspaceDivideintoareasaccordingtothecachecapacity,thenumberofblocksineachareaofthemainmemoryisequaltothetotalnumberofblocksinthecache;
3)AblockofthemainmemorycanonlybestoredinthecachewhenitisstoredinthecachePositionwiththesameblocknumber.
Datablockswiththesameblocknumberineachareaofthemainmemorycanbetransferredtotheaddresswiththesameblocknumberinthecache,butonlyoneblockcanbestoredinthecacheatthesametime.Sincethetwofieldsofthemainblocknumberandthecacheblocknumberandtheaddressintheblockarecompletelythesame,onlytheareacodeofthetransferredblockcanberecordedwhenthedirectoryisregistered.Thedirectorytableisstoredinhigh-speedandsmall-capacitymemory,andincludestwofields:theareanumberofthedatablockinthemainmemoryandtheeffectivebit.Thecapacityofthedirectorytableisthesameasthenumberofcachedblocks.
Theadvantageofthedirectassociativemethodisthattheaddressmappingmethodissimple.Whenaccessingdata,youonlyneedtocheckwhethertheareacodeisequal,soyoucangetfasteraccessspeedandsimplehardwareequipment;thedisadvantageisthereplacementoperationFrequent,thehitrateisrelativelylow.
3.Metoda skupinového asociativního mapování
Theaddressmappingruleofthegroup-associativemappingmethodisthatablockinthemainmemorycanonlybestoredinanyblockofthesamegroupnumberinthecache.Thebasicrealizationideais:
1)Hlavní paměť a mezipaměť jsou rozděleny do bloků podle stejné velikosti;
2)Hlavní paměť a mezipaměť jsou rozděleny do skupin podle stejné velikosti:
3)Themainmemorycapacityisanintegermultipleofthecachecapacity.Themainmemoryspaceisdividedintoareasaccordingtothesizeofthecachearea.Thenumberofgroupsineachareaofthemainmemoryisthesameasthenumberofgroupsinthecache;
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.
Paměť zahrnuje dva typy paměti pouze pro čtení (ROM) a paměti s náhodným přístupem (RAM).
Paměť pouze pro čtení (ROM)
Paměť pouze pro čtení je ROM (ReadOnlyMemory)). Když je ROM vyrobena, informace (data nebo program) jsou uloženy a trvale uloženy. Informace lze pouze číst, nikoli zapisovat, a data nebudou ztracena, i když je stroj vypnutý. (DIP)integrovaný blok.
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.
Nevolatilní paměť (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.
Typy a složení pevných disků
ThetypesofharddisksmainlyincludeSCSI,IDE,andthepopularSATA.Therearecertainstandardsfortheproductionofanykindofharddisk.Withtheupgradeofthecorrespondingstandard,theharddiskproductiontechnologyisalsoupgrading.Forexample,theSCSIstandardhasgonethroughSCSI-1,SCSI-2andSCSI-3.Atpresent,weoftenvisitthewebsiteTheUltral-160seenbytheserverisbasedontheSCSI-3standard.IDEfollowstheATAstandard,andthecurrentpopularSATAisanupgradedversionoftheATAstandard.IDEisaparallelportdevice,whileSATAisaserialport.SATAwasdevelopedtoreplaceIDE.
Obecně řečeno, bez ohledu na to, jaký druh pevných disků se skládá z disku, hlavy, vřetena, řídicího motoru, řídicí jednotky hlavy, převodníku dat, rozhraní, mezipaměti atd.
TheharddiskstructureisshowninFigure2-6.Alldiscsarefixedonarotatingshaft,whichisthediscspindle.Allthediscsareabsolutelyparallel.Thereisamagneticheadonthestoragesurfaceofeachdisc,andthedistancebetweenthemagneticheadandthediscissmallerthanthediameterofthehair.Alltheheadsareconnectedtoaheadcontroller,andtheheadcontrollerisresponsibleforthemovementofeachhead.Themagneticheadcanmoveradiallyalongtheradiusofthedisc(actuallyitisanobliquetangentialmovement).Eachmagneticheadmustalsobecoaxialatthesametime,thatis,whenviewedfromdirectlyabove,allmagneticheadsoverlapatalltimes(However,thereisalreadyamulti-headindependenttechnology,whichisnotsubjecttothislimitation).Thediscrotatesatahighspeedataspeedofthousandsofrevolutionsperminutetotensofthousandsofrevolutionsperminute,sothatthemagneticheadcanreadandwritedataataspecifiedlocationonthedisc.
Princip práce pevných disků
1.Povrch disku
Thedisksofharddisksgenerallyusealuminumalloymaterialsasthesubstrate,high-speedharddisksItisalsopossibletouseglassasthesubstrate.Eachdiskofaharddiskhastwosides,namelytheupperandlowersides.Generally,eachsidewillbeusedtostoredataandbecomeaneffectivedisksurface.Therearealsoveryfewharddiskswithoddnumberofsides.Eachsucheffectivediskhasadisknumber,whichisnumberedsequentiallyfromtoptobottom,startingfrom0.Intheharddisksystem,thedisksurfacenumberisalsocalledtheheadnumber,becauseeachvaliddisksurfacehasacorrespondingreadandwritehead.Thedisksetofharddiskshas2to14platters,usually2to3platters,sothediskfacenumber(headnumber)is0~3or0~5.
2. Sledovat
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. Válec
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. Sektor
Theoperatingsystemstoresinformationontheharddiskintheformofsectors(Sector).Eachsectorincludestwomainparts:sectoridentifierandstorageThedatasegmentofthedata(usually512B).
Identifikátor sektoru, také nazývaný hlavička sektoru, zahrnuje tři čísla, která tvoří trojrozměrnou adresu sektoru:1)Číslo disku:hlava(nebo disk),kde je sektorumístěný2)Číslo válce:Track,určetesměrradiáluhlavy:3)Číslosektoru:Data na dráze,které se také nazývá.
Thesectorheaderalsoincludesafield,inwhichthereisamarkthatidentifieswhetherthesectorcanreliablystoredata.Someharddiskcontrollersalsorecordpointersinthesectorheader,whichcandirectthedisktoareplacementsectorortrackwhentheoriginalsectoriswrong.Finally,thesectorheaderendswithacyclicredundancycheck(CRC)value,sothatthecontrollercancheckthereadoutofthesectorheadertoensureaccuracy.
Thedatasegmentofasectorisusedtostoredatainformation,includingdataanderrorcorrectioncodes(ECC)fordataprotection.Duringtheinitialpreparation,thecomputerfills512virtualinformationbytes(thestoragelocationoftheactualdata)andtheECCnumberscorrespondingtothesevirtualinformationbytesintothispart.
Princip přístupu
Zásobník
Zásobník je prostor pro zaznamenávání volací dráhy a parametrů, když je spuštěn program Jazyk: včetně rámce volání funkcí, předávání parametrů a ukládání zpáteční adresy a poskytuje proměnný prostor.
Basicknowledgeofstack
1.Související registry
1)esp:ukazatel horní části hromádky;
2)ebp:baseaddresspointer(ebpispoužitýkzaznamenáváníaktuálnífunkcevolázákladníadresuvClanguage);
3)cs:eippointsheaddressdalší instrukce,existují dva případy;
(1)Postupné provedení: vždy ukažte na další příkaz s po sobě jdoucími adresami;
(2)Skok/větvení:Po provedení tohoto návodu bude hodnota cs:eip upravena podle potřeb programu;
4)call:pusť aktuální hodnotuofcs:eipovrch zásobníku,cs:eippointdo vstupní adresy volanéfunkce;
5)ret:Pophodnotacs:eipůvodně zde uloženázvrchuzásobníkuavložce:eip;
6)iret:Popthecs:eip a vlajky původně uložené zde z horní části zásobníkuHodnota,putitincs:eipandflagregister.
2.Operace zásobníku
1)push:ukazatel navrchu zásobníku se zmenší o 4 bajty (32 bitů):
2)pop:ukazatel v horní části zásobníku se zvětší o 4 bajty (32 bitů).
Použití zásobníku během volání funkce
TheoperationofthestackduringthefunctioncallisshowninFigure3.AmainfunctioncallsaForsub-functions,thespecificstepsofthecallingprocessaredescribedasfollows:
Před provedením hovoru esp ukažte navrchní část hromádky a debpbod na spodek sady;
Po provedení volání se původní hodnota cs:eipis uloží do horní části zásobníku a poté se hodnota cs:eip zadá do vstupní adresy volaného programu;
Zadejte volaný program,První instrukce:pushl%ebp,druháinstrukce:movl%esp,%ebp;
Vstupte do volaného programu a pak může být zásobník vsunut do zásobníku atd. Normální provoz;
Ukončete volaný program, první instrukce je rovna % ebp, % esp, druhá instrukce je rovná % ebp a třetí instrukce je obnovena. V tuto chvíli opusťte volaný program a obnovte hlavovou korunku na eip přes ret.
Princip lokality
Princip lokality se týká toho, k čemu je přístup, když CPU přistupuje k paměti, zda se jedná o pokyny nebo přístup k datům. Úložné jednotky jsou seskupeny v malé souvislé oblasti.
Lokalita obvykle má dva tvary:
Časová lokalita:Pokud není položka k informacím zpřístupněna, je pravděpodobné, že k ní bude v blízké budoucnosti znovu přístup.
Spatiallocality:Theinformationthatwillbeusedinthenearfutureislikelytobeclosetotheinformationcurrentlyinuseinthespatialaddress.
Alllevelsofmoderncomputersystems,fromhardwaretooperatingsystems,toapplications,aredesignedusingtheprincipleoflocality.Atthehardwarelevel,theprincipleoflocalityallowscomputerdesignerstosaverecentlyreferencedinstructionsanddataitemsbyintroducingasmallandfastcachememory,therebyincreasingthespeedofaccesstothemainmemory.Attheoperatingsystemlevel,thelocalityprincipleallowsthesystemtousemainmemoryasthemostrecentlyreferencedcacheinthevirtualaddressspace.Thelocalityprinciplealsoallowsthesystemtousethemainmemorytocachethemostrecentlyuseddiskblocksinthediskfilesystem.Theprincipleoflocalityalsoplaysanimportantroleinthedesignofanapplication.Forexample,aWebbrowserplacesarecentlyciteddocumentonalocaldisk,usingtemporallocality.AlargenumberofWebserversstorerecentlyrequesteddocumentsinfront-enddiskcaches.Thesecachescansatisfyuserrequestsforthesedocumentswithoutanyinterventionfromtheserver.
Thefollowingthreeexamplesareusedtoillustratethelocalityoftheprogram'sdatareference.
Příklad1:
intsumvec(intv[N])
{
inti=0,součet=0;
for(inti=0;i
{
součet+=v[i];
}
výnosový součet;
}
Intheabovecode,thevariablesumisreferencedonceineachloopiteration,whichhastimelocality.Fortheelementsofthearrayv,theyarestoredaccordingtothemTheorderinthememoryisreadsequentially,soithasspatiallocality,buteacharrayelementisonlyaccessedonce,soithasnotemporallocality.ItcanbeseenthatthesumvecfunctionhasbothspatiallocalityandtimefordataaccessLocality.
Příklad 2:
intsumarrayros(intv[M][N])
{
inti=0;j=0;součet=0;
for(i=0;i
for(j=0;j
{
součet+=v[i][j];
}
výnosový součet;
}
Intheabovecode,Theelementsofarrayvareaccessedaccordingtothestepsize1,soithasgoodspatiallocality(arrayelementsarestoredinroworder).
Příklad 3:
intsumarrayros(intv[M][N])
{
inti=0;j=0;součet=0;
for(j=0;j
for(i=0;i
{
součet+=v[i][j];
}
výnosový součet;
}
Intheabovecode,theelementsofthearrayvareaccessedaccordingtothestepsizeN,soitsspatiallocalityVerybad.Insummary,thefollowingconclusionscanbedrawn:
1)Programy, které opakovaně odkazují na stejnou proměnnou, mají dobrou časovou lokalitu;
2)ForthosewithasteplengthofkTheprograminthereferencemode,thesmallerthestepsize,thebetterthespatiallocality.Theprogramthatjumpsaroundinthememorywithlargesteps,thespatiallocalitywillbepoor;
3)Pro načítání instrukcíJinými slovy, smyčka má dobré tempo a prostorovou lokalitu. Čím menší těleso smyčky, tím více smyčky, tím lepší lokalita.