Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's an article[0] from Dave Dice (a quick search for "biased lock java hashCode header)

Edit: Found a copy[1] of the early Cliff Click's blog... For whatever reasons google doesn't have it listed (so I typed the url. cliffc.org is empty as well.. Other than that Java's hotspot source is available too.

[0]: https://blogs.oracle.com/dave/biased-locking-in-hotspot

[1]: https://www.h2o.ai/blog/biased-locking/



Thanks!

So am I correctly understanding this as:

Using identityHashCode() does not prevent locks from working, it merely prevents the performance optimization of biased locking (which Java 15 disables by default anyway)?


Something like that. The biased locking is an overall a software fix for a hardware shortcoming, notably CAS being slow (and need for a fence on the read part, but that's pretty much free on the most of the hardware nowadays).

Lack of biased locking could be quite detrimental to CHM wide use. OTOH it'd mean a smaller header/memory footprint, which is nice.

If you are interested in the Java internals Cliff Click's (who is the original hotspot architect) insights of a decade ago will worth your while.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: