Inter-OfficeMemorandumToMBrown,TaftDateOctober8,1982FromKollingLocationPARC/CSLSubjectInternalFunctioningofAlpine'sFilePageMgrFileDoc>FilePageMgrInternals.tiogaXEROXOverviewThismemodescribestheinternalfunctioningofFilePageMgrandsupersedesallpreviousmemosonthissubject.Itisbasedonmemosbymyself,MarkBrown,andEdTaft.FilePageMgrisasimplefilesystemthatisacomponentofAlpine.ItprovidesfilesatroughlythesamelevelofabstractionasPilotdoes(noaccesscontrol,notransactions,etc).ItsitsjustabovePilot,inordertoisolatetherestofAlpinefromPilot.FilePageMgrisimplementedusingmainlythePilotSpaceandFileinterfaces;sinceSpaceandFilearegoingtochangedrasticallyinthemoderatelynearfuture,FilePageMgr'simplementationnowisquickanddirty.FilePageMgrdependsmainlyonthePilotswapperfordatatransfers,whileretainingtheabilitytoforcewrites,startwritebehinds,andrequestreadaheads.DataaccessthroughFilePageMgrisinthemappedstyleofVMDefs:FilePageMgrisresponsiblefortheassignmentofvirtualmemorytoportionsoffiles(unlikePilotwhichmakestheclientresponsibleforthis).ThemajordeparturefromVMDefsisthatFilePageMgrdealswitharunofpagescalledaVMPageSet;therearerestrictionsonthemaximumsizeofaVMPageSet;asaresult,itwillbeinconvenientforclientsofFilePageMgrtomanipulatedatastructuresthatoverlappageboundaries.GeneralCommentsFilePageMgrisrobust.Itexpectstoseeanddealcouthlywithsuchthingsasmultipleclientstryingtoaccessthesamepageandpagerequestspastthecurrenteof.Other"interesting"concurrentoperationswillhappenwithoutthingsbreaking,althoughitisexpectedthattheupperlevelsofAlpinemaynotactuallyberequestingthosetypesofconcurrency.Forexample,concurrentSetSizesforagivenfilewillresultinbothbeingdone,buttheorderisundetermined.Similarlyapagerequestforapageaftertheoldeofwhenafileisbeingconcurrentlylengthenedwilleithergetthepageorwillgetapasteoferror,dependingonwhichrequestgetstothefilefirst.WehaveattemptedtooptimizeFilePageMgr'simplementationfortheclientusagethatweexpect.Aclientdoing"strangethings",suchasmultipleprocessestouchingafileindifferentmodes,willlikelyexperienceperformancedegradation,butdatawillnotbelost.1pîÆïaC îÅ qî ìï]arîòï]aîqî+¯ï]arî6ï]aî;Rî<ßqî ìïY~rîòïY~qî+¯ïY~sî6ïY~rî:–ïY~î;“ïY~qî ìïUœrîòïUœî) î!ëî#¤î) qî ìïQ¹rîòïQ¹ð&tî{ïJuî ìï@)sî ìï;ýî øî#îþîPîX î%žrî'Jï;ýî(1ï;ý sî/kï;ýî0ï;ýî2 î8âî:Äî@FîDõîFíî ìï:VîqîèîTî5î;îøîôî#±î'pî,8î.ïî1"î ìï7 îîwî™î÷îYîÌî"“î#÷î%î,:î-ëî3=î4­î:5î=î>¬îCºîFî ìï5Yî %îÑ îÀîaîšî¾î 0î$1î)/î+( î2ôî6bî7Ìî:î<³î@¨îD9îEÚî ìï3±î ¡îëîQîøî¸îDî±î"à î+î,‡ î4ßî8�î='î?�îBÙîFØî ìï2 î ò îwîî?î$î"*î$¬î(¥î*‚î/Y î6 î7æî:t îAÊîEî ìï0c îÙ îšî€î Íî${î'î+ î3î8gî<Úî>ÂîAîD+î ìï.»î î îóîœîWî «î$Ùî&|î)îî.=î1Aî4³î:-î<ØîA¡îD°î ìï+fî cîŠîÛ î$î ©î"qî$êî*Qî-›î/mî68 î>�î@ îGRî ìï)¿î d î�î^îÐîUî!î&—î(hî+nî08î3–î7¼î< î>„îB] î ìï(î Eîtîhîzî×î!Zî'î(˜î+ƒ î3Íî7gî:žî;äî>–î@kîDRîHeî ìï&p îþîÒîp î ¶î#î%°î,|î/rî1uî2ê î;-î=&î>šîCîD¨îGžî ìï$É îîOî“îL î"{î$) î+Qî.V î4—î7fîBîC îEÐî ìï 5 îÆ îÊ î ®î#/î&4î(ßî+Tî-Evî)ÈïöÿTVm$qThebasicunitofvmwithwhichFilePageMgrdealsisaChunk,anumberofcontiguouspagesofvm.(TheFilePageMgrclientdealswithaVMPageSet,whichcorrespondstoaChunkorportionofaChunk,butwhichdoesnotgivetheclientaccesstoFilePageMgrimplementationdetails.)TherearethreemaintypesofChunks:normal(forfiledatapages),log(forAlpine'slogfiledatapages),andleader(forfileleaderpages).EachofthesetypesofChunkshasanassociatedlrulistwhichismanagedbyFilePageMgr.IfFilePageMgrneedstoreclaimvm,ittakesthelruChunkoftheappropriatetype.ThesizeofeachtypeofChunkisfixedforagivenFilePageMgrinstance.AnAlpinefilehasaleaderpage,whichispage0;wedon'teverexpecttheleaderpagetotakeupmorethanonediskpagebecauseadditionalfilepropertiesbelongnotintheleaderpage(s)butratherinadistributeddatabasesomewhere.FilePageMgr'sclientsaccesstheleaderpageinoperationsseparatefromoperationsonthedatapagesofthefile;thisisthereasonforkeepingtheChunksforleaderpagesseparatefromtheChunksfornon-leaderpages,sothatwecanavoidunnecessaryIO.Thereisanpossibleintegrityproblemconcerningtheuseofmulti-pageChunks.Whenanypageofaspaceisdirtied,thesubsequentPilotwritewritesouttheentirespace.Thiswouldleadtoaproblemshouldacrashoccurduringthewriteofapagewhichhasnotbeendirtied.BecausePilot'suniformswapunitscurrentlyhaveperformanceandimplementationproblems,wehaveavoidedsolvingthisproblembytheuseofonepagelonguniformswapunitsunderlyingtheChunks.Instead,eachnormalChunkiscurrentlyaleafspaceanditsintegrityispreservedbythebackupsystem.EachlogChunkhasregularonepageswapunitsunderlyingit.EachleaderChunkisonepagelong.ThereiscurrentlynowaytogetPilottoswapoutamulti-pagespacewhileguaranteeingthatthewritesoccurinascendinglogicalpageorder.ThelogChunksweresetupwiththeirregularunderlyingonepageswapunitssothatMark'sdesignofthelogimplementationcanhandlelogwritesinsuchawayastoavoidthisconsistencyproblem.FilePageMgr'sreleaseroutinesarecalledwithparametersthattellFilePageMgrwhetherornottheclientisdoingsequentialorrandomIO,andiftheChunkhasbeendirtied.FilePageMgrusesthisinformationtodecidewheretoputtheChunksonitslrulists,andtohandlewritebehindforsequentialIO.Religiousstatement:iftheclientsofFilePageMgrrespectthepageCountsinthereturnedVMPageSet,theywillnevergetanaddressfault.OnestickypointintheimplementationistheresultofPilot'srestrictionsonchangingthelengthofamappedfile.Thisleadstothefollowingrestriction:SetSizereturnsanErrorifthereisaChunkwithusecount<>0whichextendsbeyondeitherthenewortheoldeof.DataStructuresandMonitorsAChunkhasassociatedwithitatleastthisinformation:fileHandle:neededwhentakingChunksoffthelrulist.useCount:incrementedby1foreachcurrentuser.startingPageNumberinfile.prev,nextlinksforlrulistofChunks.infofortheredblackChunktreeofthefiletowhichthisChunkiscurrentlymapped.defWritePending:ifthisisset,thentheChunkneedstobegiventoaprocessfordeferredwriting.AnyChunk,mappedorunmapped,inanlrulistornot,regardlessofitsuseCountmaybeinthehandsofoneormoreprocessesfordeferredwriting.(Theunmappedstateisduetothechunkbeing"remapped"andcausesnoharm.)InadditiontothetypesofChunksmentionedpreviously,Chunksofthefollowingtypesexist:2sî ìïaŒî ÐîNî=îîlî’î« î&åî*oî+æî-î2î3Fî8}î:B îA>îEîFÙî ìï_äî 1 îTî îzî‰î § î(sî,u î4 î5¬î6Êî;Oî=îAÚîC‡îD¥î ìï^=î fînî˜îîíîFîî#î$¯ î,× î6¯îøîAÞîD—îF^î ìïW î îæî�îîªîÿîBî  î(Uî.¯î1î5¹î8;î:Èî< î@FîCýîH#î ìïUøî Eî�î×î~î•îøîjî# î&ùî(»î+Çî-ìî1’î4Êî7‰î:Šî=ãîC î ìïTQî ¸ î’î{îSîdî &î$¬î)Ìî,°î1 î31î4¾ î<îB î ìïRª îóî4î=î™î!¸î$ûî&¥ î-Oî2£î6 î<°î>²îAîDîGÖî ìïQî îLî!îÀîRîßîPî#¯î&Aî+‹î-ûî2Rî6Pî;Ûî?vîBîGRî ìïO[ îÑîôî¸î†î®î9î!ø î)™î ìïLî ùîoîjî·î;î!Ê î(Ûî+Fî-Æî/‰ î6zî<�î@¤îCPîF¡îHeî ìïJ[î ¶î7îîŠ îÈî!#î$¶î(Íî+Wî-Ëî1Íî6ˆî9·î=úîAîBÌîD î ìïH´î‚îÆîtîNîÙîRî!êî#½î%î(aî,‰î/î1§î5î:žî?úîD7î ìïG î ™î<îSîÔ î#î& î0î6¸î9î<›îBîFíî ìïEeîpîkîÊî?îøî£îêî!î&[î)Íî-5 î4%î6„î¾î ìîUî0î4î î¶îüî!@î"íî&]î(Ðî)ø î0Ûî4Žî8A î@dîC0îE�î ìï=î ¿î€îèîUî®î"dî%Nî'´î,Ýî0@î2pî4•î7Âî;î?à îFãî ìï;oî /îŸîîÅî�î(î!tî#*î%†î'Ö î1²î4:î8¾î;î? î@·îCæîE îGáî ìï9Èî šîZîû î.î ìï6o îëîeî¦îíî"Øî%ç î,áî/¤î1ö î:î?[îAîC{îEÏî ìï4Èî Iî îŽîBîTî¹î!bî"³î%î)†î+ìî/:î4i î<ˆî?rîB î ìï3!î šîöîî¼î=îœî³î!¹î#“î%Æî(àî+—î-Fî1Íî5Jî9óî<0 îB²î ìï/Èî îHî±îîcî!$ î)Zî. î0q î7øî9­î<îA· î ìï.!î üî§îrî»î«î•î ìï*Èî îûî¯îrîç î"Ûî$[î&Ðî*°î,~î0¶ î7Çî9âî?ÔîBHîF—îHeî ìï)!îBî—î¹î>îõî\î#v î*ûî/Ìî4‡î6î:;î;¤î?5î@©îAÚîFtî ìï'yî aî8îîRî_î`î!Jî%6î'–î*„î,Gî.§î1uî ìï!œî ^ î î«sî ìïkwî yïkî vïksîùïkîÀïkîn îÛîöîLîäî" î$« î ®ïæ îpî9îîî!î&2î(eî*Äî,÷î ®ï9îÖ î¹îµîêî!'î$Xî)!î ®ï�îiîî ®ïáî+î;î‹îÉîûî9îòî ®ï5î�îÎî-î¢îLîÞî! î#Yî%¹î("î)Ðî-Þî0€î5î6}î<îAîBáîE`î ®ï �îx îQîîBî!Hî ®ï 5î¥î<îîšîVî7î#uî*x î2Gî7†î9gî;îîB)îEåvî)Èïö èTVm$WtreeHeader(forredblackChunktreesoffiles),lruHeader,andostGeneral(forusebytheredblacktreepackageforitsownpurposes).ThisishowChunksareallocatedanddeallocated:ostGeneral:duringinitialization,twoChunksoftypeostGeneralarepermanentlyallocatedforusebytheredblacktreepackage.lruHeader:duringinitialization,threeChunksoftypelruHeaderarepermanentlyallocatedforusebythelrulistsmanager.normal,log,leader:duringinitialization,afixednumberofChunksofthesetypesarepermanentlyallocatedtoFilePageMgr'svmpool.treeHeader:theseChunksareallocatedanddeallocatedasthesystemruns.Furtherdetailsbelow.AFPMFileObjecthasassociatedwithitatleastthisinformation:fileHandle:immutableonceaFPMFileObjecthasbeencreated.chunkTable:redblacktreeofalltheChunkscurrentlymappedtothisfile.nMappedChunks.fileDataSize:sizeonthedisk,notcountingtheleaderpage.exists:whetherornotthisfileexistsonthedisk.nDefWriteChunks:numberofChunkswaitingfordeferredwrite.nLruListChunks:usedtoprotectagainstaclientfloodingcache.AFPMFileObjectisallocatedwhenafileisfirsttouchedbyFilePageMgr(i.e.FilePageMgrispassedaFileMap.HandlesuchthatGetFilePageMgrHandle=NIL).ItisdeallocatedbythegarbagecollectorafterFilePageMgrcallsFileMap.UnregistertounregisterthehandlewhentherearenolongeranyChunksmappedtothatfile.WhentheFPMFileObjectisallocated,theChunkoftypetreeHeaderforitschunkTableisalsoallocated;thetreeHeaderChunkisdeallocatedbythegarbagecollectorwhentheFPMFileObjectgoesaway.LRUlistsThelrulistsofChunksaremaintainedbytheFilePageMgrLruImplmodule.Anlrulistisadoubly-linkedcircularlist.AlistcontainsthepermanentlyallocatedlruHeaderChunkandzeroormoreotherChunks,thelatterallofthesametype:normal,leader,orlog.Thereisonesuchlistforeachtype,makingthreelistsinall.Allthreelistsareprotectedbythesinglemodulemonitor,FilePageMgrLruImpl,whichisdiscussedinmoredetailbelow.WhennoprocessisinsideofanyFilePageMgrmonitor,itistruethataChunkisonanlrulistiffithasuseCount=0.TheChunksonanlrulistmaybemappedorunmapped;exceptduringstatetransitions,allunmappedChunksareonanlrulist.ChunktablesThereisoneChunktableperFPMFileObject.AChunktableconsistsofatreeHeaderChunkandared-blacktreeofChunksattachedtoit.EveryChunkmappedtoafile,regardlessoftheChunk'suseCount,isinthefile'schunkTable.ManipulationofChunktablesisperformedthroughtheRedBlackTreepackage'sOrderedSymbolTableinterfaceandprotectedbyitsmodulemonitor,RedBlackTreeImpl,whichisdiscussedinmoredetailbelow.MonitorsTheFilePageMgrdatastructurescontainasingletypeofmonitor,theFPMFileObjectobjectmonitor.OneFPMFileObjectobjectmonitorisbuiltintoeachFPMFileObject.Inaddition,theFilePageMgrimplementationcontainsthemodulemonitorFilePageMgrLruImpl.Monitorscanonlybenested3sî ®ïb! îÁînîÙîyî!î$=î%ìî)¡ î0}î3+ î:î<Èî?3îA$îCzîEåî ®ï`yîpî²îïîÊîÎ î ®ï]'îÈî3î8îNî¡î!hî$ î ®ïYÔ î¤îî!Mî#øî) î*Åî-Ô î4Íî7 î?îDÞîGî ®ïX,î©î î~î(îêî ®ïVƒ î7î¦î ßî$gî)|î+3î.Bî4Ïî7! î?îDÞîGî ®ïTÜî©î î;îýî ®ïS2î»î_îqîÚî& î'/î*¥î/Êî1{î6Šî8;î;½î?JîA– î ®ïQ‹îtî# î.îŒî ®ïOâ îEîÎîäî7î$þî'¶ î.éî0—î2öî7rî;hî@~îDÎî ìïK¹wî yïK¹î UïK¹ sî ïK¹îçïK¹î• îî!î"rî$ î'0î)Ñ î ®ïI: îpîVîœîÆ î)™î,î/kî ®ïG‘ î7î¬îVîîÑî!Áî$ î)7î/î4aî6î8±î ®ïEç î ®ïD> îWîî îhî®î"#î'Ôî*4î.Wî ®ïB•î`î®îrîçîˆîñî#¦î%¬î( î ®ï@ëî"îOî î%î)ñî,.î1³î ®ï?Bîøî4îãî!‹î&(î'Qî+î0Šî ®ï;ïî# îÞî2îâî"î#‘î%ãî'8î)øî/$î1 î9 î;¾ îCÕîE)î ®ï:Hî î‘îùîýî-üî0î4ìî6šî8< î?¦îAØîDnî ®ï8¡îiîÐ î+î!fî-Ãî/� î65î8Àî=sîATîE îG‰î ®ï6ùîöî›îµîî»î"�î%Ûî)øî,\ î63î7¤ î=Çî@+îDÁîFî ®ï5R îºîæî¯ î)î ƒî#> î)ßî,- î3:î7ºî9 î@6îB îDnî ®ï3«î=îòîQ î"$î%>wî ìï/‚î usî ®ï-îÆî9î:î4îŠî î&…î(Áî+`î8Úî?6îAÉîD<îF¹îHeî ®ï+\ î…î{î—î%î!dî&Èî)) î1#î6ëî={îBîDÆîGËî ®ï)´îIîñîhîÐîmî!fî#(î%�î)î-5î2Sî6×î8£î;äî?îîAcîDîGQî ®ï( îñî)î˜î‡îî ßî"”î%mî'Æî+Vî.î0yî6•î8—î:ýî>ïîCõî ®ï&fîRîsîòî&î'Ðî+vî/Tî4cî8Žî:§î?ŽîA îE"îFîî ®ï$¾ îÕîgî¶îîöî"½î#ßî(jî)Îî+Íî-¶î/áî2î3êî59î7¦î=Éî?§îA¨îDyî ®ï#î±îžîÍîîîöî@î!î(Ôî-!î1Žî4¼ î;´î=¡îDyî ®ï!pîîîøî*wî ìïGîmsî ®ïÈî­îîÀîOîµî( î)Òî+\î/ëî3Qî8Oî:î;- îBHîFØî ®ï!î ÎîÚî“îCîPî"Âî$hî&ˆî*uî.þî4Cî5éî7 î9 î@îAÊîD!î ®ïzîaîýîÛîkîá î%ª î.nî0Wî5î96î:ÒîAÇîG/î ®ïÒ î î�î*Nî0Yî3uî9ðî�îCõî ®ï+îÔîâîNî$Wî&î)™î-dwî ìïsî ®ï ƒîe îsîX î yî%7î&@î* î,ûî.“î4 î6K î?þîCöî ®ï Üî  îbîjî"šî#õî'+î)òî- î7žî9\î?îA` î ®ï 5 î¥î!îšî#²î) î7Tî=_î@îC5îE?vî)Èï DTVm$% CTVm$-inthisorder:FPMFileObjectmonitorRedBlackTreepackage'sRedBlackTreeImplFilePageMgrLruImplmonitorFileMap'sFileObjectmonitorNoprocesseverholdsmorethanoneFPMFileObjectmonitoratatime.Aprocessinamonitorinthislistdoesnotnecessarilyholdallofthe"ancestor"monitorsinthelist.ThevariousmonitorscontrolreadandwriteaccesstothefieldsofFPMFileObjectsandChunksasfollows:FPMFileObject:(FPMFileObject)fileHandle.(FPMFileObjectandRedBlackTreeImpl)chunkTable.(FPMFileObject)nMappedChunks.(FPMFileObject)fileDataSize.(FPMFileObject)exists.(FPMFileObject)nDefWriteChunks.(FPMFileObjectandFilePageMgrLruImpl)nLruListChunks.MappedChunk:(FPMFileObject*)fileHandle.(FPMFileObject*)useCount.(FPMFileObject*)startPageNumber(FPMFileObjectandFilePageMgrLruImpl,exceptjustFilePageMgrLruImplforneighborrelinking)prev,next.(FPMFileObjectandRedBlackTreeImpl)rbLLink,rbRLink.(FPMFileObjectandRedBlackTreeImpl)rbColor.(FPMFileObject)defWritePending.UnMappedChunk:BelongstoFilePageMgrLruImpl.*chunk.fileHandle=nullHandletellsusthataChunkisunmapped.AprocesswillonlywriteChunk.fileHandle,Chunk.startPageNumber,andChunk.useCountwhenaChunkisnotlinkedonthelrulist(itcantellthisbecauseonlyChunkswithuseCountsof0areonthelrulist);ThisisbecauseaprocessintheFilePageMgrLruImplmonitortryingtogeta"strange"ChunkwantstoknowiftheChunkismappedtoafile;ifitisnot,theprocesscansnarfitupimmediately;ifitis,itwantstopassbackacopyofthefileHandleandstartPageNumberasahinttothecaller,whomustthengettheappropriateFPMFileObjectmonitorbeforeitcantrytofreeuptheChunk.TheFileMap'sFileObjectmonitorisusednearthebeginningofmanyFilePageMgroperationstoprotectthecheckingforand,ifnecessary,generationoftheFilePageMgrHandlefieldoftheFileObject.Algorithms4sî ®ïb)î\îýî ®ï^Ó î�î ®ï]) î¤îÃî ®ï[~îçî ®ïYÓî$ îèî ®ïV}î î×îÕîƒîî!0î#Õ î-¢î2Ýî4oî5’î9‡î; î?ÛîA‚îB¦îGáî ®ïTÖîOî�î½î2 î î!<î#,î$åî'E î. î3Ïî5}î7Üî ®ïQ€îˆîRîîÎî!ëî$¤î(#î,3î-ãî0Eî3ûî5¶ î@îBÉîGáî ®ïOÙî ®ïL„ î ®ïI.îs î ®ïGƒ îúî±î%ù î ®ïEØîs î ®ïD.îs î ®ïBƒîsî ®ï@Øîsî ®ï?- îúî±î'dî ®ï;Øî'î ®ï8‚î$ î ®ï6×î$î ®ï5,î$î ®ï3‚ îúî±î'Cî+“î.5î;nî=¬î ®ï1× î÷îuî ®ï0, îúî±î%ùî+Õî ®ï.� îúî±î%ùî ®ï,Öîsî ®ï)� î ®ï&+îØî‡î ®ï"ÖîLîY î!´î$¾î&µî)«î*üî/µî1Hî9Nî;î?ýîBÐîFî ®ï!.îGî'üî*Ë î5rî9>î:€î?)î@¬îC8îG‰î ®ï‡î îeîµî—î5î§î[î"�î%¼î*äî.î4Óî6Ÿî7æî:Lî×îAîDöîH#î ®ïàîñî<î2îîƒî)Þî/Aî3dî54î7Ÿî8êî?*îCÞîGàî ®ï8îuîÞîFîáîUî«î!bî"”î& î'uî(Ôî*Hî-î/…î4bî6õî:pî;Ïî=é îFÏîH9î ®ï‘îtîÌî°î`î\î¥îÑî %î!áî$C î+ î-Ãî8¦î:Wî;ƒî>iî@îB{îF‹î ®ïêîî<î…îä îC î)î.Xî2§î3ýî6ˆî8°î:_î=+î?>îA�î ®ï”î˜î! îøî"Lî#Êî'î*Fî,¸î36î5î8ß îA îGàî ®ïíî¬î`îrîî iî" î(à î/ùî2î4¼îA›îE!îG/î ®ïE uî ìï n vî)Èïöÿ’TVm$^:Wî;ƒî>iî@îB{îF‹î ®ïîî<î…îä îC î)î.Xî2§î3ýî6ˆî8°î:_î=+î?>îA�î ®ï¦î˜î! îøî"Lî#Êî'î*Fî,¸î36î5î8ß îA îGàî ®ïÿî¬î`îrîî iThedescriptionsofalgorithmsbelowaregenerallywrittenintermsofnormalChunks;variousportionsofthealgorithmswillbeunnecessaryforChunksofothertypes.ThealgorithmsarealsodescribedintermsofeachChunk;inactualfact,weoptimizevariousoperationsoverChunks.WhenwerefertomappingaChunk,itshouldbeunderstoodthatthatprocessincludesenteringtheChunkinthefile'sredblacktreeandsoforth,withtheobviouscorrespondingoperationsforunmapping.Uninterestingdetailsofthealgorithmsandmosterrorhandlingareomitted.MostoftheproceduresinitiallycallGetFilePageMgrHandleAndRegister;thisistheroutinethatchecksfortheexistenceofand,ifnecessary,createstheFilePageMgrHandleundertheprotectionofFileMap'sFileObjectmonitor,andthenregistersitselfasauseroftheFileMap.Handle.ThecorrespondingunregisteringisdoneattheendoftheFilePageMgrprocedure.ReleaseVMPageSetOuralgorithmsassumethatChunksfromfilesdeclaredrandomaccessshouldpersistforawhileinthecache(thelrulist),whilecleanChunksfromfilesdeclaredsequentialaccessaremuchmoreexpendable.Wewishtopreventclientfilesthataredeclaredrandomaccessbutarereallyaccessedsequentiallyfromfloodingthecache.Therefore,ifduringreleaseofnormalChunksfromafiledeclaredrandomaccess,anabnormalnumberofpagesfromthefileareinthelrulistrelativetothetotalnumberofpagesinthelrulist,wetreatsuchChunksassequential.However,becausesomerandomlyaccessedfilesmaytemporarilybelegitimatelyaccessedinasequentialmanner(forexample,whenenumerationistakingplace),themeasureswetaketohandlecachefloodingaretransitory.ForceOuttheChunkifthishasbeenrequested.EnterFPMFileObjectmonitor.Ifthisfileisnormal,findoutifitisfloodingthecacheand,ifso,changetheChunk'sparameterstosequential.DecrementtheuseCount.IftheuseCounthasgoneto0:PuttheChunkonthelrulist,asmruifdirtyormrurequested,elselru.Ifthisisadirtysequentialchunkanditisn'talreadywaitingfordeferredwrite,markitaswaiting,incrementthecountofdeferredwritewaitersforthisfile,andifthatisatitslimit,startaprocess(es)todosomedeferredwrites.(TheChunksfortheseprocessestohandlearefoundbysearchingthefile'sredblacktreefirstbackwardsandthenforwardsfromthecurrentChunkposition,untilwefindasmanyChunksmarkedfordeferredwriteasourcountofwaiterssaysweshould.ThedefWritePendingbitisclearedforeachChunkfound.)ExitFPMFileObjectmonitor.DemonProcess(handlesdeferredwrites)ForceOuttheChunkswewerestartedwith.NotethatwhentheseChunkswereputonthelrulistbyReleaseVMPageSet,theywereputonasmru,toreducethepossibilitythatsomeonelookingforaChunktoremapwouldgetoneofthemandthereforehavetowaitfortheirwrite.IfthecallerofReleaseVMPageSetactuallywantedtheseChunkstobelru,wedothatnow;itisdoneinsidetheFPMFileObjectmonitor,andonlyforChunksthatarestillinthesamestate(samemapping,onlrulist,andNOTdefWritePending)aswhenthisprocessstarted.ReadPages,ReadLogPages,ReadLeaderPagesBasically,thisprocedurewantstogetaChunkthatisalreadymappedtothedesiredstate;ifnosuchChunkexists,theproceduremustfindanotherChunkandmapit;ofcourse,thelattermay5sî ìïb)î ½ îLîý î¹î ¿î# î(êî-•î/<î2ÿî4±î9fî?kîD,î ìï`‚î ªî îÖî‡î| î!"î#dî(î*<î-àî2ãî5¿ î<ˆî>àîA±îGáî ìï^Úî Çî�îÐîî=îPî!dî#›î)Pî.( î4æî8î>!îBHîD€îGàî ìï]3î¾îþîþîjîüî î%Lî(1î+î/ÿî5yî:òî=gîBîCÓîFIî ìï[Œî wî8îîßî¹î›îÌî!Bî&y î/† î6Kî8ž î@ð î ìïYäî;îôîT îîÏî+î"�î(Yî*¬î ìïVŽî qî&î� î„îî î79î9Öî;>î=šîB^îE)î ìïTçî *î‰îgî î0î‘ î ýî%„î'äî4nî8qî:Ñ îA_îCî ìïS@ îõîÔîÐî<î"ãî&…î(xî)çî-%î/$î1Èî={î@˜ î ìïQ˜ î2îžîî©îîÀîyî!Ø î* wî ìïMksî ®ïJéî™ îeî6î î#+î&šî)�î/î4Gî8]î<áîA9îC~îGáî ®ïIBî1î îîsî¦î~î#5î(oî+ùî/ î4³ î;Yî?ŠîBîEüî ®ïGš îÉîOî{î%î!!î$Ýî'Æî*�î,Þî2_î7{î;„î>î@OîDî ®ïEó îbîèî€îþî$ã î+»î-:î1Êî6oî8Fî="îBWîEÝîG%î ®ïDLîIî€îüîî$Cî)†î+Uî/7î2´î5*î7ªî:î;Øî>Nî@—îBìîGàî ®ïB¤î)îjî²î†îlî6î!±î#ÿî&°î(óî,@î/Œî4¾î6‡ î>îDmî ®ï@ýîGî‚îî÷î" î)qî+i î2Øî8Yî:î;> îAÇîFØî ®ï?Vî¥î€ î«î =î$‘î)î+£î1»î4 î7(î8ýî=ªîA�îG;î ®ï=® î ®ï:XîâîBîÔî5îÖî Kî#¨ î ®ï8­îx îKîoï7îÔîYî¦îõîíî¿î!î"\î#•î$äî*@î,ƒî02î3%î4iî6iî:ôî=7îBˆ îoï5[î îoï3´î�îáîoï2 îñîQî{îðîLî úî1ï0eî¼îî®î´î î"Fî$Üî&Šî)ƒî*äî.6î/úî2ó î9ŒîxîA9îB˜îD#îEðî1ï+oîCîp îcîî!î$³î*:î/î2rî7‹î9Ëî=WîCWîEî1ï)Èî|î�îtî î"Öî&î(€î,"î.Üî1¬î8]î; î>)îCÑîG/î1ï(!î î±î!^î$¸î&òî)óî+´î/‘î4ºî9Ìî<îA³îECîGî1ï&yî>î.î î &î"…î(Jî+Yî65î8‰î:,î?!îA•îDýî1ï$Òî ®ï#+îœ îowî ìïýî¤sî‚ïýîüïýîî‹î ®ï{îâîBîXîîÑî$Mî ®ïÐî.îîÆîZîzî"Öî%aî'rî)Üî,î.aî0gî<Ïî?éîCEîEÐîGáî ®ï)î îÃîJî´ îAî"î'ßî,Ýî/%î0Zî4÷î6°î:ÿî?8îA‹îDBîFî ®ï�î`îDî†î0î$î]î" î&ðî(nî*Éî.yî0-î1).GetSizeEnterFPMFileObjectmonitor.GetthesizefromtheFPMFileObject.ExitFPMFileObjectmonitor.6sî ®ïb) îºîÚîkî!‚î&[î* î/]î2gî6½î9�î<òî?*îBåîG/î ®ï`‚ î=îøîÉîjî± î(†î.¨ î5bî8Rî9Àî>‹î@<îCýîG}î ®ï^Úîm îÎîŒî4î!_î"‚î%Tî&üî(¤î,Rî2¢î70î:Oî=èîBRîDŸîGgî ®ï]3îî°î`îæ î�î 9î&h î.hî1î4Ëî6îî9=î> î@DîF^î ®ï[Œî9î½î×îBî<î›î%î)î*Íî--î3?î9«î>îî ®ïXî îºîhî ®ïVfî ®ïR÷îx îKîoïQ@ îEîÒîoïO˜îøî!î³îÎî-î"öî(²î1ïMñî‘îñ îžî ƒî#îî'î): î2î3ž î1ïLJîZîµ î\î ;î# î& î-Áî/Âî2î4Hî6î8(î;* îCúîE�î1ïJ¢îoïHûî_ î5îî…î$†î&4î,¬î.†î ®ïGTîœ îoî ®ïCî;în îUî înî%üî)°î+Âî.-î1î4Aî7Rî9þî=/î?ñîB$îEŒîGFî ®ïAZîž îKîˆîî"î!Sî$üî ®ï=ëî ®ï<4îxîØî îoï:}îèî?îiîòîUî"€î'`î(­î, î.bî0Œî3”î5 î77î<Ôî?mîEüîoï8ÕîRî4î ®ï7.îœîûî5î ®ï5wî2îgîî9î‚î3î ¾î"óî&; î0î5Uî8î:8î;éî@”îAìîD¦î ®ï3ÏîîkîÊîýî´îî<îþî ®ï2î ®ï0aî ®ï,òwî ìï'¼ îxsî ®ï%!îÇî< îîî|î"¨î$`î)vî+/î-Žî/÷î2Åî4î6Æî9àî>¾î@5îA¡îG/wî ®ï#z î§ îôsî*£ï#zî+jï#zî1ãî6–î<ÌîA2îG“wî ®ï!Ósî·ï!ÓîRï!Óî±î"-î%Ùî(ö î/ÿî1°î43î6•î;®î=¶î@îBNîDŽîF>î ®ï +î;wî¨ï +î¥ï +îâ î&psî1¸ï +î2ï +î3 î68î8•î>yî@/îBŒîGŸî ®ï„î\î…wî ìï2îc sî ®ï—î°îwî™ï—î–ï—î¿ î$8sî.§ï—î/lï—î3¥î6\î7›î:´î=îB]îD¦î ®ïïî}î‚îâîBîîãîCî#/î(î*xî/ î0vî4°î8pî9Ñî?ûîA0wî ìï�sî ®ïîx îKîoï Kî1î‘î<î£î î ®ï £îœ îovî)ÈïýÿÂTVm$ 8•î>yî@/îBŒîGŸî ®ïkî\î…wî ìï/îc sî ®ï£î°îwî™ï£î–ï£î¿ î$8sî.§ï£î/lï£î3¥î6\î7›î:´î=îB]îD¦î ®ïüî}î‚îâîBîîãîCî#/î(î*xî/ î0vî4°î8pî9Ñî?ûîA0wî ìï Ásî ®ï 5îx îKvî)ÈïýÿNTVm$HSetSizeSetSizemustbewareofChunksmappedfromareasofthefilethatwillcausePilotdistress.Forlengthen,itconcernsitselfwiththeoldeofbeing"inconvenientlymapped."Fortruncate,itconcernsitselfwiththeneweofbeing"inconvenientlymapped,"andanyChunkspasttheneweofbeingmapped."Inconvenientlymapped"meansthepageisinthemiddleofaChunk;beingthelastpageinaChunkisnot"inconvenient."IftheseproblemChunkshaveuseCounts#0,SetSizewillreturntotheclientwithanerror;otherwise,SetSizewillwriteoutthe"inconvenientlymapped"ChunksandKilltheotherChunks,andthenunmapthemandputthemonthelrulist.ThenitrequestsPilottomakethefilesizechangeandupdatesthesizefieldintheFPMFileObject.NaturallythisisalldoneundertheprotectionoftheFPMFileObjectmonitor.DeleteThisisusesthesameroutinesasSetSize;itusesFile.DeleteinsteadofFile.SetSize.CreateWithIDCreatesthe(permanent)filebystraightforwardcallsonPilot.InitializestheFPMFileObject.GenerateFileIDGetsanunuseduniqueidfromPilot,sothecallercanlatersupplyittoCreateWithID.ShareVMPageSetEnterFPMFileObjectmonitor.IncrementstheuseCountoftheChunkunderlyingtheVMPageSet.ExitFPMFileObjectmonitor.ForceOutVMPageSetDoesaForceOutontheChunkunderlyingtheVMPageSet.Doesn'tneedtheprotectionoftheFPMFileObjectmonitor,sinceForceOutonunmappedChunksisano-op.ForceOutFileEntertheFPMFileObjectmonitor.BuildalistofChunksmappedtothisfilebycallinganenumerationroutineintheredblacktreepackage.Thelistisconstrainedinsizetoavoidthisclienthoggingthesystem.ExittheFPMFileObjectmonitor.ForceouttheseChunks.Repeat,startingtheenumerationfromwhereweleftoffeachtime,untilnomoreChunks.ForceOutEverythingUsestheFileMapenumerationroutineGetNext(fileHandle)andcallsForceOutFileforeachfileHandle.GetAttributesEnterFPMFileObjectmonitor.GettheattributesbycallingPilot.ExitFPMFileObjectmonitor.7wî ìïb4sî ®ï_¬î�îîæî·î æî&Lî)Ëî-aî/2î1ªî4,î7î9×î=¤îAîFãî ®ï^îŽîÇî[îšî˜î!Ûî$'î&iî*î3âî:‚î=îB¥îCÞî ®ï\]î+îfîæîõîtî`î)jî/áî2¹î5{î:±î=¶î@6îCEîEÄî ®ïZ¶îî'î#<î'—î* î-kî.îî0³î3)î7èî9¸î:ùî@¶îD˜îGî ®ïYîëî‘î²î;îžî î%[î&Õî*Uî/Ñî4Þî8î>Âî@ŸîB#îFãî ®ïWgîñî´î)îþî.î3î"Ì î)cî.Aî1î4”î7î9“îC‘î ®ïUÀîÖî î�îóî¥î#&î%ðî)(î-ãî1î4Iî6Ýî:xî<‘î?îAIîD‡îH9î ®ïTîæî îšî.îmî¶î!Aî%Éî(`î-Wî/–î2!î51î6¿î8þ îClî ®ïRqîOî»î«îî î î# î$Æî'& î0ùwî ìïN<sî ®ïK´îÈî3î-îŒî îWî!î&Ëî("î+ î2+î6Þî8— wî ìïG~ sî ®ïDöî—î÷ îÏî8î 4î)Æî,Õî.Ûî2ý î91î;� wî ìï@Á sî ®ï>9îôîäî®îVîî lî$ î%Îî(.î+âî.mî1“î6î7Zwî9ï>9î:ï>9 sîA€ï>9wî ìï: sî ®ï7{îx îKîoï5Î îŒîëîî Ïî#.î'À î.°î1 î ®ï4&îœ îowî ìï/ñsî ®ï-iîVî îôîîšî!L î(\î*Û î3wî8­î<)î>© îEVîG/î ®ï+ î�îî�î%Âî'Èî.£î3ºî5%î6Owî ìï'Œ sî ®ï%îxîØ î«îoï#Vî<îrî¼î‚î¥î"ÿî$»î'iî)ßî+çî0Yî2V î:gî?<î@÷îCcîEåîoï!¯î1îOî'îeîÑ î&%î'Óî*~î,-î/ìî2Žî6Nî;�î=ïî ®ï îœîû îÎî ®ïZî™îî˜î ®ï¬î¹î£î î!î$nî(†î*­î-"î/Uî2†î6î9Jî;Pî>ãwî ìïvsî ®ïïîTî îø î!Rî&pî,o î4|î7‰î:î îCËîF^î ®ïG wî ìï sî ®ï Šîx îKîoï Üî1î‘ î¦î¢î!î ®ï 5îœ îovî)ÈïöÕTVm$ØRestoreCacheToCleanStateThisisaroutinefordebugging.ItusestheFileMapenumerationroutineGetNext(fileHandle)andtriestounmapalltheChunksforallthesefiles.ThenitcallsaFilePageMgrLruImplroutinethatchecksthateachlrulistcontainsalltheChunksoftheappropriatetypeandthatallthoseChunksareunmapped.Clearly,ifthesystemisnotquiescenteithervariouserrorswillbereturnedorthecachemaynotactuallybecleanwhentheprocedurefinishes.8wî ìï`½sî ®ï^Bî»îî8îõî& î ¢î" î$úî'Mî,Û î4Óî9�î?, îFØî ®ï\›î»îsî%îîˆî§î!îî#èî'zî+Wî.ÿî0_î3xî4«îAîîFÁî ®ïZóîîóî,îhî®î!î#î%zî*˜î,Zî. î6*î9Bî<î>Ùî@ÑîDyî ®ïYLî îÏîöî_îÆî$Iî%¼î(8î.Uî2Iî7î;î=Éî?ÁîEdîG/î ®ïW¥îyî}îòî îúî �î$Bî&¢î-%vî)Èï–TVm$¶î îÏîöî_îÆî$Iî%¼î(8î.Uî2Iî7î;î=Éî?ÁîEdîG/î ®ïQ îyî}îòî îúî �î$Bî&¢î-%vî)ÈïèTVm$Ó TIMESROMANþŸ HELVETICAþŸ TIMESROMANþŸLOGOü´ TIMESROMANþŸLAURELþŸ TIMESROMANþæ TIMESROMANþY‚ ´ ¸X$ …/’6¼=~?j/B @™Î6„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿFilePageMgrInternals.tioga 8-Oct-82 18:40:20