資源描述:
《The Java Memory Model》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在學術(shù)論文-天天文庫。
1、TheJavaMemoryModel?JeremyMansonandWilliamPughSaritaV.AdveDepartmentofComputerScienceDepartmentofComputerScienceUniversityofMaryland,CollegeParkUniversityofIllinoisatUrbana-ChampaignCollegePark,MDUrbana-Champaign,IL{jmanson,pugh}@cs.umd.edusadve@cs.uiuc.eduABSTRA
2、CTMeaningsofPrograms]:OperationalSemanticsThispaperdescribesthenewJavamemorymodel,whichGeneralTerms:Design,LanguageshasbeenrevisedaspartofJava5.0.Themodelspeci?esKeywords:Concurrency,Java,MemoryModel,Multithread-thelegalbehaviorsforamultithreadedprogram;itde?nes
3、ingthesemanticsofmultithreadedJavaprogramsandpartiallydetermineslegalimplementationsofJavavirtualmachinesandcompilers.1.INTRODUCTIONThenewJavamodelprovidesasimpleinterfaceforcor-Thememorymodelforamultithreadedsystemspeci?esrectlysynchronizedprograms–itguarantees
4、sequentialcon-howmemoryactions(e.g.,readsandwrites)inaprogramsistencytodata-race-freeprograms.Itsnovelcontributionwillappeartoexecutetotheprogrammer,andspeci?cally,isrequiringthatthebehaviorofincorrectlysynchronizedwhichvalueeachreadofamemorylocationmayreturn.Ev
5、-programsbeboundedbyawellde?nednotionofcausality.eryhardwareandsoftwareinterfaceofasystemthatadmitsThecausalityrequirementisstrongenoughtorespectthemultithreadedaccesstosharedmemoryrequiresamemorysafetyandsecuritypropertiesofJavaandweakenoughtomodel.Themodeldete
6、rminesthetransformationsthattheallowstandardcompilerandhardwareoptimizations.Tosystem(compiler,virtualmachine,orhardware)canapplyourknowledge,othermodelsareeithertooweakbecausetoaprogramwrittenatthatinterface.Forexample,giventheydonotprovideforsu?cientsafety/sec
7、urity,oraretooaprograminmachinelanguage,thememorymodelforthestrongbecausetheyrelyonastrongnotionofdataandmachinelanguage/hardwareinterfacewilldeterminethecontroldependencesthatprecludessomestandardcompileroptimizationsthehardwarecanperform.transformations.Forahi
8、gh-levelprogramminglanguagesuchasJava,theAlthoughthemajorityofwhatiscurrentlydoneincompil-memorymodeldeterminesthetransformationsthecompilerersislegal,thenewmodelintr