资源描述:
《The Java Memory Model》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、TheJavaMemoryModel∗JeremyMansonandWilliamPughSaritaV.AdveDepartmentofComputerScienceDepartmentofComputerScienceUniversityofMaryland,CollegeParkUniversityofIllinoisatUrbana-ChampaignCollegePark,MDUrbana-Champaign,IL{jmanson,pugh}@cs.umd.edusadve@cs.uiuc.eduABSTRA
2、CTMeaningsofPrograms]:OperationalSemanticsThispaperdescribesthenewJavamemorymodel,whichGeneralTerms:Design,LanguageshasbeenrevisedaspartofJava5.0.ThemodelspecifiesKeywords:Concurrency,Java,MemoryModel,Multithread-thelegalbehaviorsforamultithreadedprogram;itdefines
3、ingthesemanticsofmultithreadedJavaprogramsandpartiallydetermineslegalimplementationsofJavavirtualmachinesandcompilers.1.INTRODUCTIONThenewJavamodelprovidesasimpleinterfaceforcor-Thememorymodelforamultithreadedsystemspecifiesrectlysynchronizedprograms–itguarantees
4、sequentialcon-howmemoryactions(e.g.,readsandwrites)inaprogramsistencytodata-race-freeprograms.Itsnovelcontributionwillappeartoexecutetotheprogrammer,andspecifically,isrequiringthatthebehaviorofincorrectlysynchronizedwhichvalueeachreadofamemorylocationmayreturn.Ev
5、-programsbeboundedbyawelldefinednotionofcausality.eryhardwareandsoftwareinterfaceofasystemthatadmitsThecausalityrequirementisstrongenoughtorespectthemultithreadedaccesstosharedmemoryrequiresamemorysafetyandsecuritypropertiesofJavaandweakenoughtomodel.Themodeldete
6、rminesthetransformationsthattheallowstandardcompilerandhardwareoptimizations.Tosystem(compiler,virtualmachine,orhardware)canapplyourknowledge,othermodelsareeithertooweakbecausetoaprogramwrittenatthatinterface.Forexample,giventheydonotprovideforsufficientsafety/sec
7、urity,oraretooaprograminmachinelanguage,thememorymodelforthestrongbecausetheyrelyonastrongnotionofdataandmachinelanguage/hardwareinterfacewilldeterminethecontroldependencesthatprecludessomestandardcompileroptimizationsthehardwarecanperform.transformations.Forahi
8、gh-levelprogramminglanguagesuchasJava,theAlthoughthemajorityofwhatiscurrentlydoneincompil-memorymodeldeterminesthetransformationsthecompilerersislegal,thenewmodelintr