您好,欢迎访问三七文档
TakingI/OSeriously:ResolutionReconsideredforDiskJulianaFreire,TerranceSwiftandDavidS.WarrenDepartmentofComputerScienceStateUniversityofNewYorkatStonyBrookfjuliana,tswift,warreng@cs.sunysb.eduAbstractModerncompilationtechniquescangivePrologprograms,inthebestcases,aspeedcomparabletoC.However,Prologhasproventobeunacceptablefordata-orientedqueriesfortwomajorreasons:itspoorterminationandcomplexitypropertiesforDatalog,anditstuple-at-a-timestrategy.Anumberoftablingframeworksandsystemshaveaddressedthe rstproblem,includingtheXSBsystemwhichhasachievedPrologspeedsfortabledprograms.YettablingsystemssuchasXSBcontinuetousethetuple-at-a-timeparadigm.Asaresult,thesesystemsarenotamenabletoatightinterconnectionwithdisk-residentdata.However,inatablingframeworkthedi erencebetweentuple-at-a-timebehaviorandset-at-a-timecanbeviewedasoneofscheduling.Accordingly,wede neabreadth- rstset-at-a-timetablingstrategyandproveititerationequivalenttoaformofsemi-naivemagicevaluation.Thatis,weextendthewell-knownasymptoticresultsofSeki[10]byprovingthateachiterationofthetablingstrategyproducesthesameinformationassemi-naivemagic.Further,thisset-at-a-timeschedulingisamenabletoimplementationinanenginethatusesPrologcompilation.Wedescribeboththeengineanditsperformance,whichiscomparablewiththetuple-at-a-timestrategyevenforin-memoryDatalogqueries.Becauseofitsperformanceandits nelevelofintegrationofPrologwithadatabase-stylesearch,theset-at-a-timeengineappearsasanimportantkeytolinkinglogicprogramminganddeductivedatabases.1IntroductionItisoftennecessarytoleavetherelationalmodeltoreasonaboutthecontentsofadatabase,aproblemwhichdeductivedatabasesseektoremedy.Deductivedatabaseschooseastheirdatamodel rst-orderlogicorarestrictionsuchasDat-alog.First-orderlogichasprovenexpressiveasadataquerylanguage,andmanyevaluationstrategies,mostnotablymagicevaluation,havebeendevelopedtoem-bedrecursivegoal-orientationintheframeworkofdatabaseevaluation.Whilemagicaddsgoal-orientationtodatabaseevaluation,tablingmethodshaveaddedfeaturesofdatabaseevaluationtologicprogramminglanguages.Magicevaluationcloselyresemblestabling.Bothmagicandtablingcombinetop-downgoalorientationwithbottom-upredundancychecking.Indeed,forrange-restrictedprograms,theyhavebeenproventobeasymptoticallyequivalent[10,8]undercertainassumptions.Despitethesewell-knownequivalences,magic-stylesys-temshavetraditionallydi eredfromtablingsystems.Magic-stylesystems,suchasAditi[15],CORAL[7],andLDL[3],arebuiltuponset-at-a-timesemi-naiveengines,whiletablingsystems,suchasXSB[9],useatuple-at-a-timestrategythatre ectstheirgenesisinthelogicprogrammingcommunity.Eachclassofsystemshasitsadvantagesanddisadvantages.Presentlyforin-memoryDatalogqueries,thefastesttablingsystemsshowanorderofmagnitudespeedupovermagic-stylesystemsduetothetablingsystems’useofPrologcompilationtechnology[9].How-ever,thetuple-at-a-timestrategyoftablingsystemsisnote cientlyextendibletodisk.Acloselookattablingindicatesthatthereisnoreasonwhyaset-at-a-timestrategycannotbecloselyintegratedintoatablingengine.Doingsoo erstremen-dousadvantages.In-memorypredicatescanbeevaluatedatthebestin-memoryspeeds,whilequeriestodiskhavethesameaccesspatternsasthebestset-at-a-timemethods.Furthermore,bothoftheseapproachescanbeintegratedfullyintothewell-knownPrologenvironment.ThispaperpresentsboththeoreticalandpracticalresultsonusingPrologcompilationtechnologytoe cientlyimplementaset-at-a-timetablingsystemforde niteprograms.Themajorresultsofthispaperare: DerivationofaTightEquivalencebetweenTablingandtheSemi-NaiveEvaluationofaMagic-TransformedProgram(SNMT).Broadequivalencesbetweentablingandmagic-stylemethodshavelongbeenknown.In[10]SekiobtainedanasymptoticequivalencebetweenanaiveevaluationofaprogramrewrittenusingAlexanderTemplatesandaversionofatablingmethod.Afterspecifyingabreadth- rstsearchstrategyfortabling,weextendtheequivalenceofSekiintwoways.First,weuseasemi-naiveevaluationratherthannaiveevaluationforboththetablingandtherewritemethod.Secondandmoreimportantly,wede neanaturalmeasureofiterationequivalencebetweenset-at-a-timetablingandSNMT.Usingiterationequivalence,wedemonstratethateveryanswerofeveryiterationofourtablingstrategyisproducedatthecorrespondingiterationofSNMT. DesignandImplementationofanEnginetoEvaluateBreadth-FirstTabling.Othertablingmethodswithset-at-a-timepropertieshavebeendeveloped,mostnotablytheSLD-ALstrategyof[16].Inadditiontoiterationequivalencetomagic,theenginedescribedherehastheadvantageofusingthelow-leveldatastructuresandcompilationtechniquesofPrologtechnology.Aspresentedin[13],thistech-nology,asimplementedintheSLG-WAM,leadstoanextremelyfast,robust,and exibleimplementationofadeductivedatabaseengine.Theresultingimplementa-tionoftheBreadth-FirstXSBisavailableuponrequest.OtherversionsofXSBarecurrentlyinstalledatnearly1000registeredcommercial,academicandgovernmen-talsites. PerformanceAnalysisoftheSet-at-a-timeEngine.Surprisingly,theresultingset-at-a-timeengineisonlymarginallyslowerthanpreviouslypublishedSLG-WAMtimesforDatalogprogramswithin-memorydataonarepresentativeset
本文标题:Taking IO seriously Resolution reconsidered for di
链接地址:https://www.777doc.com/doc-3969207 .html