tag:blogger.com,1999:blog-5560209661389175529.post2309472209846012228..comments2021-11-26T19:34:10.855+00:00Comments on Mechanical Sympathy: Java Lock ImplementationsMartin Thompsonhttp://www.blogger.com/profile/15893849163924476586noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-5560209661389175529.post-64113428621341512882011-12-25T10:34:18.509+00:002011-12-25T10:34:18.509+00:00Trevor,
I format the data in bash scripts and the...Trevor,<br /><br />I format the data in bash scripts and then load it into Excel for the graphs.Martin Thompsonhttps://www.blogger.com/profile/15893849163924476586noreply@blogger.comtag:blogger.com,1999:blog-5560209661389175529.post-22690488837892078202011-12-25T04:36:37.627+00:002011-12-25T04:36:37.627+00:00What plotting library did you use to generate your...What plotting library did you use to generate your graphs?Trevor Bernardhttps://www.blogger.com/profile/11225894761907427418noreply@blogger.comtag:blogger.com,1999:blog-5560209661389175529.post-57101428589042753082011-11-19T15:37:04.404+00:002011-11-19T15:37:04.404+00:00Dave can you explain why biased locks are consiste...Dave can you explain why biased locks are consistently more expensive even in the case of of my tests above if they do not kick in until the JVM has be running a few seconds?Martin Thompsonhttps://www.blogger.com/profile/15893849163924476586noreply@blogger.comtag:blogger.com,1999:blog-5560209661389175529.post-75884080045706319862011-11-19T15:24:42.413+00:002011-11-19T15:24:42.413+00:00Thanks Dave,
I've had similar feedback from G...Thanks Dave,<br /><br />I've had similar feedback from Gil Tene. I'll re-run my tests this week based on your suggestions and post findings.<br /><br />It is the un-contended case I'm most interested in. In the low-latency trading space, contended locks impose such huge cost that they can render a system totally unsuitable.<br /><br />I'd love to know what the plans are to make synchronized faster than ReentrantLock. You can see from my results how well it does in comparison under heavy contention.<br /><br />Martin...Martin Thompsonhttps://www.blogger.com/profile/15893849163924476586noreply@blogger.comtag:blogger.com,1999:blog-5560209661389175529.post-49189456494906900832011-11-19T15:11:05.597+00:002011-11-19T15:11:05.597+00:00Martin, it's indeed true that as CAS latency d...Martin, it's indeed true that as CAS latency decreases (thanks to the efforts of modern processor designers), the utility of biased locking decreases, and that at some point in the near future it should be turned off. <br /><br />Having said, that, biased locking will only provide benefit where there's no contention, in the single-threaded case in your benchmarks. Also, we disable biased locking on objects created during the early phase a of run, so it's having no benefit in your benchmark. You might try -XX:BiasedLockingStartupDelay=0. (This made a big difference at one thread in some quick tests I tried). Even better, you might institute multiple sub-runs (say 5, at about 10 seconds each) to give the JIT a chance to completely warm up.<br /><br />Also, I should note that there are some changes in the pipeline that'll make synchronized faster than ReentrantLock for this type of benchmark. <br /><br />Regards, -Dave http://blogs.sun.com/daveUnknownhttps://www.blogger.com/profile/17674159486667810624noreply@blogger.com