Questions tagged [biased-locking]

8 questions
40
votes
5 answers

Biased locking in java

I keep reading about how biased locking, using the flag -XX:+UseBiasedLocking, can improve the performance of un-contended synchronization. I couldn't find a reference to what it does and how it improves the performance. Can anyone explain me what…
Chander Shivdasani
  • 9,878
  • 20
  • 76
  • 107
14
votes
1 answer

Where is object's hash code stored if biased-locking is enabled in HotSpot JVM?

As far as I know an object's hash code is normally stored in the header word of the object, which, for example, may have the following layout in HotSpot: | hash code | age | 0 | 01 | According to the HotSpotInternals - Synchronization with biased…
digger
  • 233
  • 1
  • 8
4
votes
1 answer

Does Java ever rebias an individual lock

This question is about the one of the heuristics Java uses of biased locking. The next paragraph is for future readers; I suspect anyone who can answer this question can safely skip it. As far as I understand, once upon a time, people noticed that…
Mark VY
  • 1,489
  • 16
  • 31
3
votes
2 answers

Biased locking design decision

I am trying understand a rationale behind biased locking and making it a default. Since reading this blog post, namely: "Since most objects are locked by at most one thread during their lifetime, we allow that thread to bias an object toward…
Bober02
  • 15,034
  • 31
  • 92
  • 178
3
votes
1 answer

How to interpret an instance's mark word?

I am trying to make sense of the output of Java object layout on a 64-bit HotSpot VM (v8). I do not understand how the first three bit of the mark word are used which according to the commentary in the linked class file should indicated weather a…
Rafael Winterhalter
  • 42,759
  • 13
  • 108
  • 192
0
votes
1 answer

Does Vert.x have plans addressing the deprecation of biased locking in Java 15?

I am in advanced stages of writing a Clojure HTTP library built on top of Vert.x. I was just made aware of the deprecation of "biased locking" starting from Java 15. I understand that Vert.x relies on it quite heavily, and I was wondering are there…
Yaron
  • 1
  • 2
0
votes
0 answers

what is different between compiled frame and interpreted frame?

Recently I was reading this, and confused with "interrupt frame" and "compiled frame", what's the different? Further more, how did they generated in JVM?
Cheng.T
  • 337
  • 1
  • 2
  • 9
0
votes
1 answer

Does calling object.notifyAll() cause lock rebiasing/inflation in Hotspot JVM?

When I call object.notifyAll() on a completely uncontented (possibly biased, if this is allowed for the current JVM) monitor, in particular if no threads are actually waiting on the monitor, does it cause monitor rebiasing and/or inflation?
leventov
  • 14,760
  • 11
  • 69
  • 98