tag:blogger.com,1999:blog-8405107760807432973.post4751208332054017038..comments2024-01-04T09:55:32.459-08:00Comments on Java Concurrency (&c): Double-Checked Locking and the Problem with WikipediaJeremy Mansonhttp://www.blogger.com/profile/04241094734813086257noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-8405107760807432973.post-19520689290797464622012-01-10T17:04:13.207-08:002012-01-10T17:04:13.207-08:00@dao I think you posted on the wrong thread. Havi...@dao I think you posted on the wrong thread. Having said that, you just have to make sure that you have your agent running from VM start.Jeremy Mansonhttps://www.blogger.com/profile/04241094734813086257noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-16059756923749549542012-01-10T16:40:35.585-08:002012-01-10T16:40:35.585-08:00It seems the mechanism of ACCT makes it impossible...It seems the mechanism of ACCT makes it impossible to start profiling a java program in the middle. Because for already loaded classes, the OnClassLoad callback of jvmti cannot be called...Daohttps://www.blogger.com/profile/08445589445030748986noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-52971334669974297472008-03-05T09:31:00.000-08:002008-03-05T09:31:00.000-08:00Christian -- yes, thank you. The example wikipedi...Christian -- yes, thank you. The example wikipedia had at the time did not have a volatile field as the holder. I fixed it at the time, and looking at it again, it looks as if it has remained fixed. I'm sorry if that was unclear from the original post.Jeremy Mansonhttps://www.blogger.com/profile/04241094734813086257noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-74421918452692345122008-03-05T02:06:00.000-08:002008-03-05T02:06:00.000-08:00Hi all,the memory model of Java was revised as of ...Hi all,<BR/>the memory model of Java was revised as of JDK 1.5, now the semantics of accessing volatile variables wrt. reordering is clarified/modified.<BR/>I.e. double checked locking *works* as of JDK 1.5, if the variable is declared as volatile.<BR/>Cheers,<BR/>ChristianAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-28354266574871249202008-01-23T14:03:00.000-08:002008-01-23T14:03:00.000-08:00liulijian: You know how it is with multithreading ...liulijian: You know how it is with multithreading -- just because something is wrong, that doesn't mean that the wrongness will always be triggered. In this case, it isn't all that likely that you will hit the combination of optimizations and processor behavior needed to get the broken behavior. <BR/><BR/>Having said that, that doesn't mean that that combination isn't legal. Writing DCL the Jeremy Mansonhttps://www.blogger.com/profile/04241094734813086257noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-52867131383301138052008-01-23T00:55:00.000-08:002008-01-23T00:55:00.000-08:00Thanks for clarify the DCL usage.However, can you ...Thanks for clarify the DCL usage.<BR/><BR/>However, can you show me an example Java program to prove the non-volatile version is broken?<BR/><BR/>I have tried to run http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckTest.java on my Core 2 Duo dekstop with JDK 5, I couldn't reproduce the DCL problem with it.liulijianhttps://www.blogger.com/profile/00309716017545778379noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-35749645272677192492007-06-12T00:03:00.000-07:002007-06-12T00:03:00.000-07:00Too late for me to write that. You already replied...Too late for me to write that. You already replied :). Thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-91084443408271318592007-06-12T00:01:00.000-07:002007-06-12T00:01:00.000-07:00I think i have got my answer by going through the ...I think i have got my answer by going through the link. Don't bother to reply :).Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-24112470503873561342007-06-11T22:34:00.000-07:002007-06-11T22:34:00.000-07:00anon: You interpreted it correctly; I mean that ei...anon: You interpreted it correctly; I mean that either a compiler or processor can reorder the assignments, or that the memory hierarchy can make it appear as if the assignments have been reordered because of weak cache consistency protocols.Jeremy Mansonhttps://www.blogger.com/profile/04241094734813086257noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-52920005165781863552007-06-11T21:59:00.000-07:002007-06-11T21:59:00.000-07:00What do you mean by "you can reorder the assignmen...What do you mean by "you can reorder the assignments" do you mean that compiler can do that depending on its semantics? <BR/>Why would a person reorder the assignment when its very clear that the correct assignment order should be there?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-47223652230180160472007-05-28T15:18:00.000-07:002007-05-28T15:18:00.000-07:00This struck me straight away as well... I have lin...This struck me straight away as well... I have linked you on my blog!Anonymousnoreply@blogger.com