Java?????????????
???????????? ???????[ 2015/5/22 13:39:17 ] ????????Java ???
???????Java??????
????Java???????????????????????????乲???????Java???????????????淶???????????????????????????????????Java?????????????JDK5????Java???????????????????1??????????????????????????????????У???????е???????mastingcopy????????????????????棬???????????workingcopy???????????????????????????Щ??????????????????????е?mastingcopy????????????????У???????????????????е?workingcopy?????????檔???????????8????????????????????е??????
????read??????????????????mastingcopy??????????????棬????????load??????á?
????load??????????????????read??????????洫????????????????????С?
????use??????????????????????workingcopy??????????????檔
????assign?????????????????????????????????洫??????????????С?
????store???洢??????????????????workingcopy?????????棬???????write??????á?
????write??д????????????潫??store??????????????????????????С?
????lock???????????????????????????????
????unlock????????????????????????????????
?????1 Java????????
??????????????????read???????????????У????????load?????????У?read??????load????????????????????????????????????????????????????????????????????store?????????????У????????write???????????У?store??????write?????????????????????????????????????????????????????????????Java???????Java????????б??????/д??????/?????????Volatile???????/д???????????????????Щ?????????????????????ο???JVM?淶????????????????Java???????????Щ????????????????????????????????????????????????????????????????????
?????μ?Java??????
??????JDK5?????Java????μ????????????????????????????????????????????????????????????????8??????????????????????????????????????
??????????????????????μ??????happens-before??happens-before????????LeslieLamport?????????????????????Time??ClocksandtheOrderingofEventsinaDistributedSystem???????????LeslieLamport???happens-before????????????У????????????????(partialordering)??LeslieLamport??????????и??????????????????????????????????????????????
????JSR-133???happens-before????????????????????????????????????ж???????/д????????????????????????????????????????????μ?happens-before????
?????????????????????е??????????happensbefore???????е??????????????
??????????????????????????????happens-before??????????????????
????volatile?????????????volatile???д??happensbefore??????????????volatile??????
??????????????Ahappens-beforeB????BhappensbeforeC?????Ahappens-beforeC??
????start()??????????A??в???ThreadB.start()????????B???????A????ThreadB.start()????happensbefore?????B?е??????????
????join()??????????A??в???ThreadB.join()????????????????B?е????????happens-before?????A??ThreadB.join()????????????
????????????????????????????????????????????????????JMM???????happens-before???????????????????????????????A????д????a??B?????????b??????happens-before?????????a??????b?????????????????У???JMM
?????2????????????????
?????????????a????????b?????????????????????????????happens-before???????????????happens-before????????????Java?????????????????????????????????????????????????????????????????????????????????????????????????????????????????á?
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11